Skip to content

Commit

Permalink
auth.service.spec: Bring back issueToken testcase
Browse files Browse the repository at this point in the history
Not quite sure why it was removed
  • Loading branch information
sashko9807 committed Nov 13, 2023
1 parent 421df97 commit 94b97bc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/api/src/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 94b97bc

Please sign in to comment.