From 6d4823a0e883200abcb313ca78d1b23f2a940ee1 Mon Sep 17 00:00:00 2001 From: LionelB Date: Tue, 19 Nov 2024 14:37:29 +0100 Subject: [PATCH] refactor(api): move reconcileSupOrganizationLearner route into prescription --- .../sup-organization-learners/index.js | 46 ---- .../sup-organization-learner-controller.js | 24 -- api/lib/routes.js | 2 - .../sup-organization-management-controller.js | 20 ++ .../sup-organization-management-route.js | 32 +++ ...up-organization-learner-controller_test.js | 51 ---- .../sup-organization-learners/index_test.js | 230 ------------------ .../sup-organization-management-route_test.js | 53 +++- ...sup-organization-management-routes_test.js | 218 +++++++++++++++++ .../organization-learner-repository_test.js | 9 +- 10 files changed, 327 insertions(+), 358 deletions(-) delete mode 100644 api/lib/application/sup-organization-learners/index.js delete mode 100644 api/lib/application/sup-organization-learners/sup-organization-learner-controller.js delete mode 100644 api/tests/integration/application/sup-organization-learners/index_test.js diff --git a/api/lib/application/sup-organization-learners/index.js b/api/lib/application/sup-organization-learners/index.js deleted file mode 100644 index ec1ce66d964..00000000000 --- a/api/lib/application/sup-organization-learners/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import JoiDate from '@joi/date'; -import BaseJoi from 'joi'; -const Joi = BaseJoi.extend(JoiDate); - -import { sendJsonApiError, UnprocessableEntityError } from '../../../src/shared/application/http-errors.js'; -import { supOrganizationLearnerController } from './sup-organization-learner-controller.js'; - -const register = async function (server) { - server.route([ - { - method: 'POST', - path: '/api/sup-organization-learners/association', - config: { - handler: supOrganizationLearnerController.reconcileSupOrganizationLearner, - validate: { - options: { - allowUnknown: false, - }, - payload: Joi.object({ - data: { - attributes: { - 'student-number': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), - 'first-name': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), - 'last-name': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), - birthdate: Joi.date().format('YYYY-MM-DD').required(), - 'campaign-code': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), - }, - type: 'sup-organization-learners', - }, - }), - failAction: (request, h) => { - return sendJsonApiError(new UnprocessableEntityError('Un des champs saisis n’est pas valide.'), h); - }, - }, - notes: [ - '- **Cette route est restreinte aux utilisateurs authentifiés**\n' + - '- Elle réconcilie l’utilisateur à l’inscription d’un étudiant dans cette organisation', - ], - tags: ['api', 'sup-organization-learner'], - }, - }, - ]); -}; - -const name = 'sup-organization-learners-api'; -export { name, register }; diff --git a/api/lib/application/sup-organization-learners/sup-organization-learner-controller.js b/api/lib/application/sup-organization-learners/sup-organization-learner-controller.js deleted file mode 100644 index 836f8a9246f..00000000000 --- a/api/lib/application/sup-organization-learners/sup-organization-learner-controller.js +++ /dev/null @@ -1,24 +0,0 @@ -import { usecases } from '../../domain/usecases/index.js'; - -const reconcileSupOrganizationLearner = async function (request, h) { - const userId = request.auth.credentials.userId; - const payload = request.payload.data.attributes; - - const campaignCode = payload['campaign-code']; - - const reconciliationInfo = { - userId, - studentNumber: payload['student-number'], - firstName: payload['first-name'], - lastName: payload['last-name'], - birthdate: payload['birthdate'], - }; - - await usecases.reconcileSupOrganizationLearner({ campaignCode, reconciliationInfo }); - - return h.response(null).code(204); -}; - -const supOrganizationLearnerController = { reconcileSupOrganizationLearner }; - -export { supOrganizationLearnerController }; diff --git a/api/lib/routes.js b/api/lib/routes.js index e2f6df7fe5e..73ccb3b893b 100644 --- a/api/lib/routes.js +++ b/api/lib/routes.js @@ -13,7 +13,6 @@ import * as organizations from './application/organizations/index.js'; import * as passwords from './application/passwords/index.js'; import * as scoOrganizationLearners from './application/sco-organization-learners/index.js'; import * as sessions from './application/sessions/index.js'; -import * as supOrganizationLearners from './application/sup-organization-learners/index.js'; import * as tags from './application/tags/index.js'; import * as targetProfiles from './application/target-profiles/index.js'; import * as userOrgaSettings from './application/user-orga-settings/index.js'; @@ -33,7 +32,6 @@ const routes = [ organizations, passwords, scoOrganizationLearners, - supOrganizationLearners, sessions, tags, targetProfiles, diff --git a/api/src/prescription/learner-management/application/sup-organization-management-controller.js b/api/src/prescription/learner-management/application/sup-organization-management-controller.js index 434c1cc35f1..707cde1140a 100644 --- a/api/src/prescription/learner-management/application/sup-organization-management-controller.js +++ b/api/src/prescription/learner-management/application/sup-organization-management-controller.js @@ -108,11 +108,31 @@ const updateStudentNumber = async function (request, h) { return h.response().code(204); }; +const reconcileSupOrganizationLearner = async function (request, h) { + const userId = request.auth.credentials.userId; + const payload = request.payload.data.attributes; + + const campaignCode = payload['campaign-code']; + + const reconciliationInfo = { + userId, + studentNumber: payload['student-number'], + firstName: payload['first-name'], + lastName: payload['last-name'], + birthdate: payload['birthdate'], + }; + + await usecases.reconcileSupOrganizationLearner({ campaignCode, reconciliationInfo }); + + return h.response(null).code(204); +}; + const supOrganizationManagementController = { getOrganizationLearnersCsvTemplate, importSupOrganizationLearners, replaceSupOrganizationLearners, updateStudentNumber, + reconcileSupOrganizationLearner, }; export { supOrganizationManagementController }; diff --git a/api/src/prescription/learner-management/application/sup-organization-management-route.js b/api/src/prescription/learner-management/application/sup-organization-management-route.js index e385e1feeff..0df666aef47 100644 --- a/api/src/prescription/learner-management/application/sup-organization-management-route.js +++ b/api/src/prescription/learner-management/application/sup-organization-management-route.js @@ -18,6 +18,38 @@ const ERRORS = { const register = async function (server) { server.route([ + { + method: 'POST', + path: '/api/sup-organization-learners/association', + config: { + handler: supOrganizationManagementController.reconcileSupOrganizationLearner, + validate: { + options: { + allowUnknown: false, + }, + payload: Joi.object({ + data: { + attributes: { + 'student-number': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), + 'first-name': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), + 'last-name': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), + birthdate: Joi.date().format('YYYY-MM-DD').required(), + 'campaign-code': Joi.string().empty(Joi.string().regex(/^\s*$/)).required(), + }, + type: 'sup-organization-learners', + }, + }), + failAction: (request, h) => { + return sendJsonApiError(new UnprocessableEntityError('Un des champs saisis n’est pas valide.'), h); + }, + }, + notes: [ + '- **Cette route est restreinte aux utilisateurs authentifiés**\n' + + '- Elle réconcilie l’utilisateur à l’inscription d’un étudiant dans cette organisation', + ], + tags: ['api', 'sup-organization-learner'], + }, + }, { method: 'POST', path: '/api/organizations/{organizationId}/sup-organization-learners/replace-csv', diff --git a/api/tests/acceptance/application/sup-organization-learners/sup-organization-learner-controller_test.js b/api/tests/acceptance/application/sup-organization-learners/sup-organization-learner-controller_test.js index 02f3770f7ba..4d3a3a6caad 100644 --- a/api/tests/acceptance/application/sup-organization-learners/sup-organization-learner-controller_test.js +++ b/api/tests/acceptance/application/sup-organization-learners/sup-organization-learner-controller_test.js @@ -13,57 +13,6 @@ describe('Acceptance | Controller | sup-organization-learners', function () { server = await createServer(); }); - describe('POST /api/sup-organization-learners/association', function () { - let organization; - let campaign; - let options; - let user; - - beforeEach(async function () { - // given - options = { - method: 'POST', - url: '/api/sup-organization-learners/association', - headers: {}, - payload: {}, - }; - - user = databaseBuilder.factory.buildUser(); - organization = databaseBuilder.factory.buildOrganization(); - campaign = databaseBuilder.factory.buildCampaign({ organizationId: organization.id }); - databaseBuilder.factory.buildOrganizationLearner({ - firstName: 'Jean', - lastName: 'Michel', - birthdate: new Date('2010-01-01'), - studentNumber: '12345', - organizationId: organization.id, - userId: null, - }); - - await databaseBuilder.commit(); - }); - - it('should return an 204 status after updating higher organization learner', async function () { - // given - options.headers.authorization = generateValidRequestAuthorizationHeader(user.id); - options.payload.data = { - attributes: { - 'student-number': '12345', - 'first-name': 'Jean', - 'last-name': 'Michel', - birthdate: '2010-01-01', - 'campaign-code': campaign.code, - }, - type: 'sup-organization-learners', - }; - - // when - const response = await server.inject(options); - // then - expect(response.statusCode).to.equal(204); - }); - }); - describe('PATCH /api/organizations/id/sup-organization-learners/organizationLearnerId', function () { let organizationId; const studentNumber = '54321'; diff --git a/api/tests/integration/application/sup-organization-learners/index_test.js b/api/tests/integration/application/sup-organization-learners/index_test.js deleted file mode 100644 index 9f2102316fb..00000000000 --- a/api/tests/integration/application/sup-organization-learners/index_test.js +++ /dev/null @@ -1,230 +0,0 @@ -import * as moduleUnderTest from '../../../../lib/application/sup-organization-learners/index.js'; -import { supOrganizationLearnerController } from '../../../../lib/application/sup-organization-learners/sup-organization-learner-controller.js'; -import { expect, HttpTestServer, sinon } from '../../../test-helper.js'; - -describe('Integration | Application | Route | sup-organization-learners', function () { - let httpTestServer; - - beforeEach(async function () { - sinon - .stub(supOrganizationLearnerController, 'reconcileSupOrganizationLearner') - .callsFake((request, h) => h.response('ok').code(204)); - - httpTestServer = new HttpTestServer(); - await httpTestServer.register(moduleUnderTest); - }); - - describe('POST /api/sup-organization-learners/association', function () { - const method = 'POST'; - const url = '/api/sup-organization-learners/association'; - - context('User association with studentNumber, firstName, lastName, birthdate and campaignCode', function () { - it('should succeed', async function () { - // given - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': 'Robert', - 'last-name': 'Smith', - birthdate: '2012-12-12', - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(204); - }); - - it('should succeed when there is a space', async function () { - // given - const payload = { - data: { - attributes: { - 'student-number': 'F001 ', - 'first-name': 'Robert ', - 'last-name': 'Smith ', - birthdate: '2012-12-12', - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(204); - expect(response.request.payload.data.attributes['first-name']).to.equal('Robert '); - }); - - it('should return an error when there is no payload', async function () { - // when - const response = await httpTestServer.request(method, url); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid student number attribute in the payload', async function () { - // given - const INVALID_STUDENT_NUMBER = ' '; - const payload = { - data: { - attributes: { - 'student-number': INVALID_STUDENT_NUMBER, - 'first-name': 'Robert', - 'last-name': 'Smith', - birthdate: '2012-12-12', - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid first name attribute in the payload', async function () { - // given - const INVALID_FIRSTNAME = ' '; - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': INVALID_FIRSTNAME, - 'last-name': 'Smith', - birthdate: '2012-12-12', - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid last name attribute in the payload', async function () { - // given - const INVALID_LASTNAME = ''; - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': 'Robert', - 'last-name': INVALID_LASTNAME, - birthdate: '2012-12-12', - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid a birthdate attribute (with space) in the payload', async function () { - // given - const INVALID_BIRTHDATE = '2012- 12-12'; - - // when - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': 'Robert', - 'last-name': 'Smith', - birthdate: INVALID_BIRTHDATE, - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid birthdate attribute (with extra zeros) in the payload', async function () { - // given - const INVALID_BIRTHDATE = '2012-012-12'; - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': 'Robert', - 'last-name': 'Smith', - birthdate: INVALID_BIRTHDATE, - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid birthdate attribute (not a proper date) in the payload', async function () { - // given - const INVALID_BIRTHDATE = '1999-99-99'; - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': 'Robert', - 'last-name': 'Smith', - birthdate: INVALID_BIRTHDATE, - 'campaign-code': 'RESTRICTD', - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - - it('should return an error when there is an invalid campaign code attribute in the payload', async function () { - // given - const INVALID_CAMPAIGNCODE = ''; - const payload = { - data: { - attributes: { - 'student-number': 'F001', - 'first-name': 'Robert', - 'last-name': 'Smith', - birthdate: '2012-12-12', - 'campaign-code': INVALID_CAMPAIGNCODE, - }, - }, - }; - - // when - const response = await httpTestServer.request(method, url, payload); - - // then - expect(response.statusCode).to.equal(422); - }); - }); - }); -}); diff --git a/api/tests/prescription/learner-management/acceptance/application/sup-organization-management-route_test.js b/api/tests/prescription/learner-management/acceptance/application/sup-organization-management-route_test.js index 4641a718092..44735ac0765 100644 --- a/api/tests/prescription/learner-management/acceptance/application/sup-organization-management-route_test.js +++ b/api/tests/prescription/learner-management/acceptance/application/sup-organization-management-route_test.js @@ -20,7 +20,58 @@ describe('Acceptance | Application | organization-controller-sup-organization-le server = await createServer(); }); - describe('POST organizations/{organizationId}/sup-organization-learners/import-csv', function () { + describe('POST /api/sup-organization-learners/association', function () { + let organization; + let campaign; + let options; + let user; + + beforeEach(async function () { + // given + options = { + method: 'POST', + url: '/api/sup-organization-learners/association', + headers: {}, + payload: {}, + }; + + user = databaseBuilder.factory.buildUser(); + organization = databaseBuilder.factory.buildOrganization(); + campaign = databaseBuilder.factory.buildCampaign({ organizationId: organization.id }); + databaseBuilder.factory.buildOrganizationLearner({ + firstName: 'Jean', + lastName: 'Michel', + birthdate: new Date('2010-01-01'), + studentNumber: '12345', + organizationId: organization.id, + userId: null, + }); + + await databaseBuilder.commit(); + }); + + it('should return an 204 status after updating higher organization learner', async function () { + // given + options.headers.authorization = generateValidRequestAuthorizationHeader(user.id); + options.payload.data = { + attributes: { + 'student-number': '12345', + 'first-name': 'Jean', + 'last-name': 'Michel', + birthdate: '2010-01-01', + 'campaign-code': campaign.code, + }, + type: 'sup-organization-learners', + }; + + // when + const response = await server.inject(options); + // then + expect(response.statusCode).to.equal(204); + }); + }); + + describe('POST organizations/{organizationId/sup-organization-learners/import-csv', function () { let connectedUser; beforeEach(async function () { diff --git a/api/tests/prescription/learner-management/integration/application/sup-organization-management-routes_test.js b/api/tests/prescription/learner-management/integration/application/sup-organization-management-routes_test.js index d5c35ed8bf3..c9b5233c387 100644 --- a/api/tests/prescription/learner-management/integration/application/sup-organization-management-routes_test.js +++ b/api/tests/prescription/learner-management/integration/application/sup-organization-management-routes_test.js @@ -7,6 +7,10 @@ describe('Integration | Application | Route | sup-organization-learners', functi let httpTestServer; beforeEach(async function () { + sinon + .stub(supOrganizationManagementController, 'reconcileSupOrganizationLearner') + .callsFake((request, h) => h.response('ok').code(204)); + sinon .stub(securityPreHandlers, 'checkUserIsAdminInSUPOrganizationManagingStudents') .callsFake((request, h) => h.response(true)); @@ -134,4 +138,218 @@ describe('Integration | Application | Route | sup-organization-learners', functi }); }); }); + + describe('POST /api/sup-organization-learners/association', function () { + const method = 'POST'; + const url = '/api/sup-organization-learners/association'; + + context('User association with studentNumber, firstName, lastName, birthdate and campaignCode', function () { + it('should succeed', async function () { + // given + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': 'Robert', + 'last-name': 'Smith', + birthdate: '2012-12-12', + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(204); + }); + + it('should succeed when there is a space', async function () { + // given + const payload = { + data: { + attributes: { + 'student-number': 'F001 ', + 'first-name': 'Robert ', + 'last-name': 'Smith ', + birthdate: '2012-12-12', + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(204); + expect(response.request.payload.data.attributes['first-name']).to.equal('Robert '); + }); + + it('should return an error when there is no payload', async function () { + // when + const response = await httpTestServer.request(method, url); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid student number attribute in the payload', async function () { + // given + const INVALID_STUDENT_NUMBER = ' '; + const payload = { + data: { + attributes: { + 'student-number': INVALID_STUDENT_NUMBER, + 'first-name': 'Robert', + 'last-name': 'Smith', + birthdate: '2012-12-12', + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid first name attribute in the payload', async function () { + // given + const INVALID_FIRSTNAME = ' '; + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': INVALID_FIRSTNAME, + 'last-name': 'Smith', + birthdate: '2012-12-12', + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid last name attribute in the payload', async function () { + // given + const INVALID_LASTNAME = ''; + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': 'Robert', + 'last-name': INVALID_LASTNAME, + birthdate: '2012-12-12', + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid a birthdate attribute (with space) in the payload', async function () { + // given + const INVALID_BIRTHDATE = '2012- 12-12'; + + // when + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': 'Robert', + 'last-name': 'Smith', + birthdate: INVALID_BIRTHDATE, + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid birthdate attribute (with extra zeros) in the payload', async function () { + // given + const INVALID_BIRTHDATE = '2012-012-12'; + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': 'Robert', + 'last-name': 'Smith', + birthdate: INVALID_BIRTHDATE, + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid birthdate attribute (not a proper date) in the payload', async function () { + // given + const INVALID_BIRTHDATE = '1999-99-99'; + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': 'Robert', + 'last-name': 'Smith', + birthdate: INVALID_BIRTHDATE, + 'campaign-code': 'RESTRICTD', + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + + it('should return an error when there is an invalid campaign code attribute in the payload', async function () { + // given + const INVALID_CAMPAIGNCODE = ''; + const payload = { + data: { + attributes: { + 'student-number': 'F001', + 'first-name': 'Robert', + 'last-name': 'Smith', + birthdate: '2012-12-12', + 'campaign-code': INVALID_CAMPAIGNCODE, + }, + }, + }; + + // when + const response = await httpTestServer.request(method, url, payload); + + // then + expect(response.statusCode).to.equal(422); + }); + }); + }); }); diff --git a/api/tests/prescription/learner-management/integration/infrastructure/repositories/organization-learner-repository_test.js b/api/tests/prescription/learner-management/integration/infrastructure/repositories/organization-learner-repository_test.js index 2ffa0b84a17..3b678f83287 100644 --- a/api/tests/prescription/learner-management/integration/infrastructure/repositories/organization-learner-repository_test.js +++ b/api/tests/prescription/learner-management/integration/infrastructure/repositories/organization-learner-repository_test.js @@ -13,6 +13,7 @@ import { findOrganizationLearnerIdsByOrganizationId, getOrganizationLearnerForAdmin, reconcileUserByNationalStudentIdAndOrganizationId, + reconcileUserToOrganizationLearner, removeByIds, saveCommonOrganizationLearners, update, @@ -1771,7 +1772,7 @@ describe('Integration | Repository | Organization Learner Management | Organizat it('should save association between user and organizationLearner', async function () { // when - const organizationLearnerPatched = await organizationLearnerRepository.reconcileUserToOrganizationLearner({ + const organizationLearnerPatched = await reconcileUserToOrganizationLearner({ userId: user.id, organizationLearnerId: organizationLearner.id, }); @@ -1787,7 +1788,7 @@ describe('Integration | Repository | Organization Learner Management | Organizat const fakeStudentId = 1; // when - const error = await catchErr(organizationLearnerRepository.reconcileUserToOrganizationLearner)({ + const error = await catchErr(reconcileUserToOrganizationLearner)({ userId: user.id, organizationLearnerId: fakeStudentId, }); @@ -1801,7 +1802,7 @@ describe('Integration | Repository | Organization Learner Management | Organizat const fakeUserId = 1; // when - const error = await catchErr(organizationLearnerRepository.reconcileUserToOrganizationLearner)({ + const error = await catchErr(reconcileUserToOrganizationLearner)({ userId: fakeUserId, organizationLearnerId: organizationLearner.id, }); @@ -1819,7 +1820,7 @@ describe('Integration | Repository | Organization Learner Management | Organizat }); // when - const error = await catchErr(organizationLearnerRepository.reconcileUserToOrganizationLearner)({ + const error = await catchErr(reconcileUserToOrganizationLearner)({ userId: user.id, organizationLearnerId: disabledOrganizationLearner.id, });