Skip to content

Commit 0c9b9aa

Browse files
committed
Add test for parsing patient id MRN with BOM
1 parent a496089 commit 0c9b9aa

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/helpers/appUtils.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const path = require('path');
22
const { parsePatientIds } = require('../../src/helpers/appUtils');
33

44
const MOCK_VALID_ID_CSV = path.join(__dirname, './fixtures/valid-mrns.csv');
5+
const MOCK_VALID_ID_CSV_WITH_BOM = path.join(__dirname, './fixtures/valid-mrns-bom.csv');
56

67
// Has no MRN column
78
const MOCK_INVALID_ID_CSV = path.join(__dirname, './fixtures/invalid-mrns.csv');
@@ -17,6 +18,15 @@ describe('appUtils', () => {
1718
expect(ids).toEqual(expectedIds);
1819
});
1920

21+
test('valid path to CSV with BOM should parse content', () => {
22+
const expectedIds = ['123', '456', '789'];
23+
const ids = parsePatientIds(MOCK_VALID_ID_CSV_WITH_BOM);
24+
25+
// Should get every MRN and correctly parse with BOM
26+
expect(ids).toHaveLength(expectedIds.length);
27+
expect(ids).toEqual(expectedIds);
28+
});
29+
2030
test('invalid path should throw error', () => {
2131
expect(() => parsePatientIds(MOCK_INVALID_ID_CSV)).toThrowError();
2232
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mrn
2+
123
3+
456
4+
789

0 commit comments

Comments
 (0)