diff --git a/__tests__/findUserPdl.spec.js b/__tests__/findUserPdl.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..a4c9063b200ef331f896ae1caf568f6b2a9208c7 --- /dev/null +++ b/__tests__/findUserPdl.spec.js @@ -0,0 +1,17 @@ +const { errors } = require('cozy-konnector-libs') +const { findUserPdl } = require('../src') + +describe('recherchePoint', () => { + it('should throw LOGIN_FAILED for too many responses', () => { + expect( + findUserPdl() + // How to get params ? + // .env + ).toBe(errors.LOGIN_FAILED) + }) + it('should throw LOGIN_FAILED for empty response', () => {}) + + it('should return a correct pdl number', () => { + // Test with a given address ? + }) +}) diff --git a/__tests__/recherchePoint.spec.js b/__tests__/recherchePoint.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..1ed6f04c41c71ae66fc160b14357f2d4ac9392fe --- /dev/null +++ b/__tests__/recherchePoint.spec.js @@ -0,0 +1,12 @@ +const { errors } = require('cozy-konnector-libs') +const { verifyUserIdentity } = require('../src/index') + +describe('recherchePoint', () => { + it('should throw LOGIN_FAILED when pdl give and recieved are not mathing', () => { + expect( + verifyUserIdentity() + // params ? + // fields.pdl value + ).toBe(errors.LOGIN_FAILED) + }) +}) diff --git a/src/index.js b/src/index.js index d9354dd6c8e9d30e911154941cf812e48b2393f9..b9ab672d310b7215819be8bfc0cfdef192685322 100644 --- a/src/index.js +++ b/src/index.js @@ -480,7 +480,7 @@ function isFirstStart() { /** * @return {Promise<string>} User Pdl */ -async function findUserPdl( +export async function findUserPdl( url, apiAuthKey, appLogin, diff --git a/yarn.lock b/yarn.lock index 30265ef2e1efa24124c1ac721c2d478e079a7242..2c0a6a47f2fc138ea1cd9225767cf9cd11146602 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5943,7 +5943,7 @@ mkdirp@^0.5.1: dependencies: minimist "^1.2.6" -mkdirp@^1.0.4: +mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==