Skip to content

Commit fa21f29

Browse files
koumatsumototimdeschryver
authored andcommitted
test(example): fix ineffective tests (#1307)
closes #1288
1 parent de1198f commit fa21f29

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

projects/example-app/src/app/auth/effects/auth.effects.spec.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,39 @@ describe('AuthEffects', () => {
8888
});
8989

9090
describe('loginSuccess$', () => {
91-
it('should dispatch a RouterNavigation action', () => {
91+
it('should dispatch a RouterNavigation action', (done: any) => {
9292
const user = { name: 'User' } as User;
9393
const action = new LoginSuccess({ user });
9494

95-
actions$ = hot('-a---', { a: action });
95+
actions$ = of(action);
9696

9797
effects.loginSuccess$.subscribe(() => {
9898
expect(routerService.navigate).toHaveBeenCalledWith(['/']);
99+
done();
99100
});
100101
});
101102
});
102103

103104
describe('loginRedirect$', () => {
104-
it('should dispatch a RouterNavigation action when auth.LoginRedirect is dispatched', () => {
105+
it('should dispatch a RouterNavigation action when auth.LoginRedirect is dispatched', (done: any) => {
105106
const action = new LoginRedirect();
106107

107-
actions$ = hot('-a---', { a: action });
108+
actions$ = of(action);
108109

109110
effects.loginRedirect$.subscribe(() => {
110111
expect(routerService.navigate).toHaveBeenCalledWith(['/login']);
112+
done();
111113
});
112114
});
113115

114-
it('should dispatch a RouterNavigation action when auth.Logout is dispatched', () => {
116+
it('should dispatch a RouterNavigation action when auth.Logout is dispatched', (done: any) => {
115117
const action = new AuthActions.Logout();
116118

117-
actions$ = hot('-a---', { a: action });
119+
actions$ = of(action);
118120

119121
effects.loginRedirect$.subscribe(() => {
120122
expect(routerService.navigate).toHaveBeenCalledWith(['/login']);
123+
done();
121124
});
122125
});
123126
});

0 commit comments

Comments
 (0)