Skip to content

Commit

Permalink
remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Dormand authored and Scott Dormand committed Dec 6, 2024
1 parent 62f5359 commit 355ccc5
Showing 1 changed file with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ describe('authenticate handler', () => {
})
})

it('throws 401 errors if no contact to be authenticated', async () => {
executeQuery.mockResolvedValueOnce([])
const result = await server.inject({
method: 'GET',
url: '/authenticate/renewal/CD379B?licenseeBirthDate=2000-01-01&licenseePostcode=AB12 3CD'
})
expect(result.statusCode).toBe(401)
expect(JSON.parse(result.payload)).toMatchObject({
error: 'Unauthorized',
message: 'The licensee could not be authenticated',
statusCode: 401
})
})

it('throws 400 errors if the required parameters are not supplied', async () => {
const result = await server.inject({ method: 'GET', url: '/authenticate/renewal/CD379B?' })
expect(result.statusCode).toBe(400)
Expand All @@ -175,27 +189,5 @@ describe('authenticate handler', () => {
statusCode: 400
})
})

// it('throws 500 errors if more than one result was found for the query', async () => {
// executeQuery.mockResolvedValueOnce([
// {
// entity: MOCK_EXISTING_CONTACT_ENTITY,
// expanded: {}
// }
// ])
// executeQuery.mockResolvedValueOnce([{ entity: { referenceNumber: 'CD379B' } }, { entity: { referenceNumber: 'CD379B' } }])
// const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(jest.fn())
// const result = await server.inject({
// method: 'GET',
// url: '/authenticate/renewal/CD379B?licenseeBirthDate=2000-01-01&licenseePostcode=AB12 3CD'
// })
// expect(result.statusCode).toBe(500)
// expect(JSON.parse(result.payload)).toMatchObject({
// error: 'Internal Server Error',
// message: 'Unable to authenticate, non-unique results for query',
// statusCode: 500
// })
// expect(consoleErrorSpy).toHaveBeenCalled()
// })
})
})

0 comments on commit 355ccc5

Please sign in to comment.