|
| 1 | +import iconv from 'iconv-lite'; |
| 2 | + |
1 | 3 | import { IMPORT_STATUSES } from '../../../../../../src/prescription/learner-management/domain/constants.js'; |
2 | 4 | import { AggregateImportError } from '../../../../../../src/prescription/learner-management/domain/errors.js'; |
3 | 5 | import { ImportScoCsvOrganizationLearnersJob } from '../../../../../../src/prescription/learner-management/domain/models/ImportScoCsvOrganizationLearnersJob.js'; |
@@ -28,9 +30,12 @@ describe('Unit | UseCase | validateCsvFile', function () { |
28 | 30 | beforeEach(function () { |
29 | 31 | organizationImportId = Symbol('organizationImportId'); |
30 | 32 | organizationId = 1234; |
31 | | - csvContent = `${supOrganizationLearnerImportHeader} |
| 33 | + csvContent = iconv.encode( |
| 34 | + `${supOrganizationLearnerImportHeader} |
32 | 35 | Beatrix;The;Bride;Kiddo;Black Mamba;01/01/1970;thebride@example.net;123456;Assassination Squad;Hattori Hanzo;Deadly Viper Assassination Squad;BAD;BAD; |
33 | | - `.trim(); |
| 36 | + `.trim(), |
| 37 | + 'utf-8', |
| 38 | + ); |
34 | 39 |
|
35 | 40 | expectedWarnings = [ |
36 | 41 | { |
@@ -235,10 +240,13 @@ describe('Unit | UseCase | validateCsvFile', function () { |
235 | 240 | it('should save VALIDATION_ERROR status', async function () { |
236 | 241 | // given |
237 | 242 | organizationImportRepositoryStub.get.withArgs(organizationImportId).resolves(organizationImport); |
238 | | - const csvContent = `${supOrganizationLearnerImportHeader} |
| 243 | + const csvContent = iconv.encode( |
| 244 | + `${supOrganizationLearnerImportHeader} |
239 | 245 | Beatrix;The;Bride;Kiddo;Black Mamba;01/01/1970;thebride@example.net;123456;Assassination Squad;Hattori Hanzo;Deadly Viper Assassination Squad;BAD;BAD; |
240 | 246 | Beatrix;The;Bride;Kiddo;Black Mamba;01/01/1970;thebride@example.net;123456;Assassination Squad;Hattori Hanzo;Deadly Viper Assassination Squad;BAD;BAD; |
241 | | - `.trim(); |
| 247 | + `.trim(), |
| 248 | + 'utf-8', |
| 249 | + ); |
242 | 250 | importStorageStub.getParser |
243 | 251 | .withArgs({ Parser: SupOrganizationLearnerParser, filename: organizationImport.filename }, organizationId, i18n) |
244 | 252 | .resolves(SupOrganizationLearnerParser.buildParser(csvContent, organizationId, i18n)); |
|
0 commit comments