Skip to content

Commit c56d61c

Browse files
author
Rodrigo Lins
committed
fix TTA-83: Fixing login component tests
1 parent 3f691c4 commit c56d61c

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

src/app/modules/login/login.component.spec.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,11 @@ describe('LoginComponent', () => {
9191
spyOn(azureAdB2CService, 'signIn').and.returnValue(of(() => {}));
9292
spyOn(featureToggleCookiesService, 'setCookies').and.returnValue(featureToggleCookiesService.setCookies());
9393

94-
component.login().toPromise()
95-
.then(result => {
96-
expect(azureAdB2CService.signIn).toHaveBeenCalled();
97-
expect(azureAdB2CService.setCookies).toHaveBeenCalled();
98-
expect(featureToggleCookiesService.setCookies).toHaveBeenCalled();
99-
});
94+
component.login();
95+
96+
expect(azureAdB2CService.signIn).toHaveBeenCalled();
97+
expect(azureAdB2CService.setCookies).toHaveBeenCalled();
98+
expect(featureToggleCookiesService.setCookies).toHaveBeenCalled();
10099
}));
101100

102101
it('should sign up or login with google if is not logged-in into the app Locally', inject([Router], (router: Router) => {
@@ -108,32 +107,26 @@ describe('LoginComponent', () => {
108107
spyOn(featureToggleCookiesService, 'setCookies').and.returnValue(featureToggleCookiesService.setCookies());
109108

110109
component.ngOnInit();
111-
component.loginWithGoogle().toPromise()
112-
.then(result => {
113-
expect(loginService.signIn).toHaveBeenCalled();
114-
expect(loginService.setCookies).toHaveBeenCalled();
115-
expect(featureToggleCookiesService.setCookies).toHaveBeenCalled();
116-
});
110+
component.loginWithGoogle();
117111

112+
expect(loginService.signIn).toHaveBeenCalled();
113+
expect(loginService.setCookies).toHaveBeenCalled();
114+
expect(featureToggleCookiesService.setCookies).toHaveBeenCalled();
118115
}));
119116

120117
it('should not sign-up or login with google if is already logged-in into the app on Production', inject([Router], (router: Router) => {
121118
spyOn(azureAdB2CService, 'isLogin').and.returnValue(of(true));
122119
spyOn(router, 'navigate').and.stub();
123-
component.login().toPromise()
124-
.then(result => {
125-
expect(azureAdB2CService.isLogin).toHaveBeenCalled();
126-
expect(router.navigate).toHaveBeenCalledWith(['']);
127-
});
120+
component.login();
121+
expect(azureAdB2CService.isLogin).toHaveBeenCalled();
122+
expect(router.navigate).toHaveBeenCalledWith(['']);
128123
}));
129124

130125
it('should not sign-up or login with google if is already logged-in into the app Locally', inject([Router], (router: Router) => {
131126
spyOn(loginService, 'isLogin').and.returnValue(of(true));
132127
spyOn(router, 'navigate').and.stub();
133-
component.loginWithGoogle().toPromise()
134-
.then(result => {
135-
expect(loginService.isLogin).toHaveBeenCalled();
136-
expect(router.navigate).toHaveBeenCalledWith(['']);
137-
});
128+
component.loginWithGoogle();
129+
expect(loginService.isLogin).toHaveBeenCalled();
130+
expect(router.navigate).toHaveBeenCalledWith(['']);
138131
}));
139132
});

0 commit comments

Comments
 (0)