-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auth.service.spec: Bring back issueToken testcase
Not quite sure why it was removed
- Loading branch information
1 parent
421df97
commit 94b97bc
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,20 @@ describe('AuthService', () => { | |
describe('issueToken', () => { | ||
const email = '[email protected]' | ||
const password = 's3cret' | ||
|
||
it('should call auth', async () => { | ||
const tokenSpy = jest.spyOn(service, 'issueToken') | ||
const token = mockDeep<Grant>({ | ||
access_token: { token: 't23456' }, | ||
}) | ||
const keycloakSpy = jest | ||
.spyOn(keycloak.grantManager, 'obtainDirectly') | ||
.mockResolvedValue(token) | ||
expect(await service.issueToken(email, password)).toBe('t23456') | ||
expect(keycloakSpy).toHaveBeenCalledWith(email, password) | ||
expect(tokenSpy).toHaveBeenCalledWith(email, password) | ||
expect(admin.auth).not.toHaveBeenCalled() | ||
}) | ||
}) | ||
|
||
describe('token endpoint', () => { | ||
|