Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/helpers/appUtils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');
const { parsePatientIds } = require('../../src/helpers/appUtils');

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

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

test('valid path to CSV with BOM should parse content', () => {
const expectedIds = ['123', '456', '789'];
const ids = parsePatientIds(MOCK_VALID_ID_CSV_WITH_BOM);

// Should get every MRN and correctly parse with BOM
expect(ids).toHaveLength(expectedIds.length);
expect(ids).toEqual(expectedIds);
});

test('invalid path should throw error', () => {
expect(() => parsePatientIds(MOCK_INVALID_ID_CSV)).toThrowError();
});
Expand Down
4 changes: 4 additions & 0 deletions test/helpers/fixtures/valid-mrns-bom.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mrn
123
456
789