Skip to content
Snippets Groups Projects
Commit 0840e453 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix: TU

parent 356c7362
No related branches found
No related tags found
2 merge requests!12Feat/donnes tech debut contrat,!10Feat/rechercher point
Pipeline #39764 failed
const { errors } = require('cozy-konnector-libs')
const { verifyUserIdentity } = require('../src/index')
const insee = require('./requests/insee')
jest.mock('../src/requests/insee', () => ({
getInseeCode: jest.fn().mockResolvedValueOnce(69),
}))
describe('verifyUserIdentity', () => {
// mock insee code
// mock find User Pdl
......@@ -9,21 +11,22 @@ describe('verifyUserIdentity', () => {
// const mockFindUserPdl = jest.fn()
it('should throw LOGIN_FAILED when pdl give and recieved are not matching', async () => {
jest.spyOn(insee, 'getInseeCode').mockResolvedValueOnce(696969)
const result = await verifyUserIdentity(
{
name: 'John',
address: '1 street',
pointId: 987654321,
postalCode: '69069',
},
'baseUrl',
'apiKey',
'login@user.com'
)
// jest
// .mock(verifyUserIdentity(), 'getInseeCode')
// .mockResolvedValueOnce(696969)
// jest.spyOn(verifyUserIdentity, 'findUserPdl').mockResolvedValueOnce(696969)
expect(
verifyUserIdentity(
{
name: 'John',
address: '1 street',
pointId: 987654321,
postalCode: '69069',
},
'baseUrl',
'apiKey',
'login@user.com'
)
).toBe(errors.LOGIN_FAILED)
expect(result).toBe(errors.LOGIN_FAILED)
})
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment