Skip to content

Commit

Permalink
Teste para a função refreshToken
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoCarlito committed Dec 8, 2023
1 parent 50ebdc9 commit d86494f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/services/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ describe('AuthService', () => {
req.flush(userResponse);
});

it('should refresh token', () => {
const dummyResponse = { access_token: 'dummyToken' };

service.refreshToken().subscribe(res => {
expect(res).toEqual(dummyResponse);
});

const req = httpMock.expectOne(`${service.usersAPIURL}/auth/refresh`);
expect(req.request.method).toBe('POST');
req.flush(dummyResponse);
});

it('should logout', () => {
localStorage.setItem('token', 'testtoken');
service.logout();
Expand Down

0 comments on commit d86494f

Please sign in to comment.