From d8461c00eb589871cdae5e2a9abc934c28443bcc Mon Sep 17 00:00:00 2001 From: Bastien Dumont <bdumont@grandlyon.com> Date: Mon, 20 Mar 2023 16:25:18 +0100 Subject: [PATCH] fix tests --- __tests__/core/verifyUserIdentity.spec.js | 16 +++++++----- importedData.json | 30 +++++++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 importedData.json diff --git a/__tests__/core/verifyUserIdentity.spec.js b/__tests__/core/verifyUserIdentity.spec.js index 390396d..db9d161 100644 --- a/__tests__/core/verifyUserIdentity.spec.js +++ b/__tests__/core/verifyUserIdentity.spec.js @@ -10,12 +10,16 @@ jest.mock('../../src/requests/insee', () => ({ getInseeCode: jest.fn().mockResolvedValue(69), })) +jest.mock('../../src/helpers/sanitizeName.js', () => ({ + sanitizeLastname: jest.fn().mockReturnValue('John'), +})) + jest.mock('../../src/index', () => ({ start: jest.fn(), })) describe('verifyUserIdentity', () => { - it('should throw LOGIN_FAILED when pdl given and recieved are NOT matching 🚫', async () => { + it('should throw LOGIN_FAILED when pdl given and received are NOT matching 🚫', async () => { findUserPdl.mockResolvedValueOnce('12345') try { await verifyUserIdentity( @@ -35,7 +39,7 @@ describe('verifyUserIdentity', () => { } }) - it('should throw TERMS_VERSION_MISMATCH when pdl give and recieved are NOT matching on alternate start 🚫', async () => { + it('should throw TERMS_VERSION_MISMATCH when pdl give and received are NOT matching on alternate start 🚫', async () => { findUserPdl.mockResolvedValueOnce('12345') try { await verifyUserIdentity( @@ -56,7 +60,7 @@ describe('verifyUserIdentity', () => { } }) - it('should return void when pdl give and recieved are matching ✅', async () => { + it('should return void when pdl give and received are matching ✅', async () => { findUserPdl.mockResolvedValueOnce('12345') expect.assertions(1) try { @@ -76,7 +80,7 @@ describe('verifyUserIdentity', () => { expect(true).toBe(false) } }) - it('should return void when pdl give and recieved are matching with stored inseecode ✅', async () => { + it('should return void when pdl give and received are matching with stored inseecode ✅', async () => { findUserPdl.mockResolvedValue('12345') expect.assertions(1) try { @@ -99,7 +103,7 @@ describe('verifyUserIdentity', () => { } }) - it('should return void when pdl give and recieved are matching with SGE second chance onboarding ✅ ', async () => { + it('should return void when pdl give and received are matching with SGE second chance onboarding ✅ ', async () => { findUserPdl.mockResolvedValueOnce(null).mockResolvedValueOnce('12345') findUserAddress.mockResolvedValueOnce({ escalierEtEtageEtAppartement: '12', @@ -127,7 +131,7 @@ describe('verifyUserIdentity', () => { } }) - it('should return void when pdl give and recieved are matching with SGE last chance onboarding✅ ', async () => { + it('should return void when pdl give and received are matching with SGE last chance onboarding✅ ', async () => { findUserPdl .mockResolvedValueOnce(null) .mockResolvedValueOnce(null) diff --git a/importedData.json b/importedData.json new file mode 100644 index 0000000..480333f --- /dev/null +++ b/importedData.json @@ -0,0 +1,30 @@ +{ + "io.cozy.files": [], + "io.cozy.accounts": [ + { + "cozyMetadata": { + "doctypeVersion": 1, + "metadataVersion": 1, + "createdAt": "2023-03-20T15:25:12.714Z", + "createdByApp": "enedissgegrandlyon", + "createdByAppVersion": "1.2.5", + "updatedAt": "2023-03-20T15:25:12.714Z", + "updatedByApps": [ + { + "slug": "enedissgegrandlyon", + "date": "2023-03-20T15:25:12.714Z", + "version": "1.2.5" + } + ] + }, + "_id": "1111111", + "account_type": "1111111", + "data": { + "name": "pouet" + } + } + ], + "com.grandlyon.enedis.year": [], + "com.grandlyon.enedis.month": [], + "com.grandlyon.enedis.minute": [] +} \ No newline at end of file -- GitLab