Newer
Older
const { errors } = require('cozy-konnector-libs')
const { verifyUserIdentity } = require('../src/index')
jest.mock('../src/requests/insee', () => ({
getInseeCode: jest.fn().mockResolvedValueOnce(69),
}))
describe('verifyUserIdentity', () => {
// mock insee code
// mock find User Pdl
// const mockGetInseeCode = jest.fn()
// const mockFindUserPdl = jest.fn()
it('should throw LOGIN_FAILED when pdl give and recieved are not matching', async () => {
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)