Skip to content

Commit 17e5932

Browse files
author
Rodrigo Lins
committed
fix: TTA-180 increasing test coveragew
1 parent ed0056b commit 17e5932

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ describe('LoginComponent', () => {
9999
expect(component).toBeTruthy();
100100
});
101101

102+
it('should set local storage when the component is initialized and is not legacy production', inject([Router], (router: Router) => {
103+
component.isProduction = false;
104+
spyOn(loginService, 'getUser').and.returnValue(of(userTest));
105+
spyOn(loginService, 'setLocalStorage');
106+
107+
component.ngOnInit();
108+
109+
expect(loginService.setLocalStorage).toHaveBeenCalled();
110+
}));
111+
102112
it('should sign up or login with google if is not logged-in into the app on Production', inject([Router], (router: Router) => {
103113
spyOn(azureAdB2CService, 'isLogin').and.returnValue(false);
104114
spyOn(azureAdB2CService, 'setCookies').and.returnValue();

src/app/modules/login/services/login.service.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ describe('LoginService', () => {
131131
expect(cookieService.deleteAll).toHaveBeenCalled();
132132
});
133133

134+
it('should return an http observable when call invalidateSessionCooke', () => {
135+
const result = service.invalidateSessionCookie()
136+
expect(result).toBeDefined();
137+
})
138+
134139
it('should call cookieService when app is isLegacyProd', () => {
135140
service.isLegacyProd = true;
136141
service.localStorageKey = 'user2';

0 commit comments

Comments
 (0)