test(aio): fix error logged during tests (#18659)

The fixed test expected there to be a doc version without a URL. This used to be
the case but not any more. As a result, an error was logged in the test output
(but no failure).

This commit fixes it by ensuring that a version without a URL exists.

PR Close #18659
This commit is contained in:
Georgios Kalpakas 2017-08-12 01:51:59 +03:00 committed by Miško Hevery
parent 17b71ae382
commit 60c803649b
1 changed files with 3 additions and 5 deletions

View File

@ -310,13 +310,11 @@ describe('AppComponent', () => {
expect(locationService.go).toHaveBeenCalledWith(versionWithUrl.url);
});
// The current docs version should not have an href
// This may change when we perfect our docs versioning approach
it('should not navigate when change to a version without a url', () => {
setupSelectorForTesting();
const versionWithoutUrlIndex = component.docVersions.findIndex(v => !v.url);
const versionWithoutUrl = component.docVersions[versionWithoutUrlIndex];
selectElement.triggerEventHandler('change', { option: versionWithoutUrl, index: versionWithoutUrlIndex});
const versionWithoutUrlIndex = component.docVersions.length;
const versionWithoutUrl = component.docVersions[versionWithoutUrlIndex] = { title: 'foo', url: null };
selectElement.triggerEventHandler('change', { option: versionWithoutUrl, index: versionWithoutUrlIndex });
expect(locationService.go).not.toHaveBeenCalled();
});
});