diff --git a/__tests__/requests/bo.spec.js b/__tests__/requests/bo.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..92fb02e6aa205e42edff8aae15ba434559da6595 --- /dev/null +++ b/__tests__/requests/bo.spec.js @@ -0,0 +1,28 @@ +const { createBoConsent } = require('../../src/requests/bo') +import * as axios from 'axios' +jest.mock('axios') +describe('Backoffice routes', () => { + describe('createBoConsent', () => { + it('should send consent to BO', async () => { + const consent = await createBoConsent({ + pdl: 11111111111111, + name: 'POUET', + adresse: '20 rue du lac', + postalCode: '69003', + inseeCode: '69383', + }) + expect(consent).toBe({ id: 'abce23' }) + }) + it('should handle unavailable BO', async () => { + axios.post.mockImplementation(() => Promise.reject({ status: 500 })) + const consent = await createBoConsent({ + pdl: 11111111111111, + name: 'POUET', + adresse: '20 rue du lac', + postalCode: '69003', + inseeCode: '69383', + }) + expect(consent).toBe(null) + }) + }) +}) diff --git a/__tests__/requests/sge.spec.js b/__tests__/requests/sge.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..28770b2b649b4aa16a4fc2149a449585baa9de6a --- /dev/null +++ b/__tests__/requests/sge.spec.js @@ -0,0 +1,6 @@ +describe('Sge routes', () => { + //TODO: write TU + it('should be true', () => { + expect(true).toBe(true) + }) +})