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:
parent
17b71ae382
commit
60c803649b
|
@ -310,12 +310,10 @@ describe('AppComponent', () => {
|
||||||
expect(locationService.go).toHaveBeenCalledWith(versionWithUrl.url);
|
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', () => {
|
it('should not navigate when change to a version without a url', () => {
|
||||||
setupSelectorForTesting();
|
setupSelectorForTesting();
|
||||||
const versionWithoutUrlIndex = component.docVersions.findIndex(v => !v.url);
|
const versionWithoutUrlIndex = component.docVersions.length;
|
||||||
const versionWithoutUrl = component.docVersions[versionWithoutUrlIndex];
|
const versionWithoutUrl = component.docVersions[versionWithoutUrlIndex] = { title: 'foo', url: null };
|
||||||
selectElement.triggerEventHandler('change', { option: versionWithoutUrl, index: versionWithoutUrlIndex });
|
selectElement.triggerEventHandler('change', { option: versionWithoutUrl, index: versionWithoutUrlIndex });
|
||||||
expect(locationService.go).not.toHaveBeenCalled();
|
expect(locationService.go).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue