Угловое тестирование роутера в жасмине с жасмином then () - PullRequest
0 голосов
/ 11 марта 2019

In .ts у меня есть:

this.router.navigateByUrl('/', {skipLocationChange: true}).then(() => this.router.navigate([LangParams.activeLang, 'login'], {queryParams: {returnUrl: returnUrl}}));

и тест

        it('should navigate to /login', inject([AuthStore, AuthenticationService, Router],
        (authStore: AuthStore, authService: AuthenticationService, router: Router) => {
            spyOn(authService, 'logout');
            const routerSpy = spyOn(router, 'navigateByUrl').and.returnValue(Promise.resolve(true));

            authStore.logout();

            expect(routerSpy).toHaveBeenCalledWith('/', {skipLocationChange: true});
        }));

Как я могу проверить навигацию () в then ()?

...