From 2387600286ee7d42a42900bfd57c140aeaab8bfa Mon Sep 17 00:00:00 2001 From: LionelB Date: Wed, 20 Nov 2024 13:06:44 +0100 Subject: [PATCH] tech(script): fix parsing param in delete and anonymise script --- api/scripts/prod/delete-and-anonymise-organization-learners.js | 3 +-- .../prod/delete-and-anonymise-organization-learners_test.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/api/scripts/prod/delete-and-anonymise-organization-learners.js b/api/scripts/prod/delete-and-anonymise-organization-learners.js index b8838aa5299..4d3f5feab41 100644 --- a/api/scripts/prod/delete-and-anonymise-organization-learners.js +++ b/api/scripts/prod/delete-and-anonymise-organization-learners.js @@ -12,7 +12,7 @@ export class DeleteAndAnonymiseOrgnizationLearnerScript extends Script { permanent: true, options: { organizationLearnerIds: { - type: 'number', + type: 'string', describe: 'a list of comma separated organization learner ids', demandOption: true, coerce: commaSeparatedNumberParser(), @@ -28,7 +28,6 @@ export class DeleteAndAnonymiseOrgnizationLearnerScript extends Script { organizationLearnerRepository = { removeByIds }, }) { const engineeringUserId = process.env.ENGINEERING_USER_ID; - logger.info(`Anonymise ${options.organizationLearnerIds.length} learners`); await DomainTransaction.execute(async () => { await campaignParticipationRepository.removeByOrganizationLearnerIds({ diff --git a/api/tests/integration/scripts/prod/delete-and-anonymise-organization-learners_test.js b/api/tests/integration/scripts/prod/delete-and-anonymise-organization-learners_test.js index fa9ee6e6b78..846c8418171 100644 --- a/api/tests/integration/scripts/prod/delete-and-anonymise-organization-learners_test.js +++ b/api/tests/integration/scripts/prod/delete-and-anonymise-organization-learners_test.js @@ -11,11 +11,10 @@ describe('DeleteAndAnonymiseOrgnizationLearnerScript', function () { const { options } = script.metaInfo; expect(options.organizationLearnerIds).to.deep.include({ - type: 'number', + type: 'string', describe: 'a list of comma separated organization learner ids', demandOption: true, }); - expect(options.organizationLearnerIds.coerce).to.be.a('function'); }); it('parses list of organizationLearnerIds', async function () {