From b5f1dc32d13b98f9d8abb5d05738180843a7642a Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Sat, 12 Aug 2017 01:51:59 +0300 Subject: [PATCH] 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 --- aio/src/app/app.component.spec.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index 1765cd85e1..23831fd3ee 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -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(); }); });