Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed May 27, 2020
1 parent 44dfbb8 commit fdcf659
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/server/verification/__tests__/verificationAPI.js
Expand Up @@ -21,6 +21,8 @@ describe('verificationAPI', () => {
const userIdentifier = '0x7ac080f6607405705aed79675789701a48c76f55'

beforeAll(done => {
//remove claim queue
Config.claimQueueAllowed = 0
Config.skipEmailVerification = false
jest.setTimeout(50000)
server = makeServer(done)
Expand Down Expand Up @@ -190,6 +192,21 @@ describe('verificationAPI', () => {
expect(whitelistUserMock).not.toHaveBeenCalled()
})

test('PUT /verify/face/:enrollmentIdentifier returns 400 when user not approved in claim queue', async () => {
Config.claimQueueAllowed = 1
helper.mockEmptyResultsFaceSearch()
helper.mockSuccessEnrollment(enrollmentIdentifier)

await request(server)
.put(enrollmentUri)
.send(payload)
.set('Authorization', `Bearer ${token}`)
.expect(400, {
success: false,
error: 'User not approved to claim, not in queue or still pending'
})
})

test('PUT /verify/face/:enrollmentIdentifier skips verification and re-whitelists user was already verified', async () => {
await storage.updateUser({ identifier: userIdentifier, isVerified: true })

Expand Down

0 comments on commit fdcf659

Please sign in to comment.