Skip to content

Commit

Permalink
feat(auth): fix auth tests for access tokens (#2053)
Browse files Browse the repository at this point in the history
  • Loading branch information
njlie authored Oct 20, 2023
1 parent 2bba62b commit 0306787
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/auth/src/accessToken/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ describe('Access Token Service', (): void => {
})

test('Can get an access token by its managementId', async (): Promise<void> => {
const retrievedGrant = await Grant.query(trx).findById(grant.id)
await expect(
accessTokenService.getByManagementId(accessToken.managementId)
).resolves.toMatchObject(accessToken)
).resolves.toMatchObject({
...accessToken,
grant: retrievedGrant
})
})

test('Cannot get an access token that does not exist', async (): Promise<void> => {
Expand Down
6 changes: 4 additions & 2 deletions packages/auth/src/signature/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ describe('Signature Service', (): void => {

expect(next).toHaveBeenCalled()
expect(ctx.response.status).toEqual(200)
expect(ctx.accessToken).toMatchObject(token)
expect(ctx.accessToken.grant).toEqual(grant)
expect(ctx.accessToken).toMatchObject({
...token,
grant
})

scope.done()
})
Expand Down

0 comments on commit 0306787

Please sign in to comment.