Skip to content

Commit 4974067

Browse files
committed
Fix paths to be full resolves; fixed one loadVS test
1 parent b6845ea commit 4974067

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/helpers/cancerStagingUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22
const { checkCodeInVs } = require('./valueSetUtils');
33

44
function isCancerStagingSystem(code) {
5-
const cancerStagingSystemVSPath = path.resolve(__dirname, './valueSets/ValueSet-mcode-cancer-staging-system-vs.json');
5+
const cancerStagingSystemVSPath = path.resolve(__dirname, 'valueSets', 'ValueSet-mcode-cancer-staging-system-vs.json');
66
return checkCodeInVs(code, cancerStagingSystemVSPath);
77
}
88

src/helpers/conditionUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function getICD10Code(condition) {
2424
* @return {boolean} if primary cancer condition
2525
*/
2626
function isConditionCodePrimary(code) {
27-
const primaryCancerConditionVSFilepath = path.resolve(__dirname, './valueSets/ValueSet-mcode-primary-or-uncertain-behavior-cancer-disorder-vs.json');
27+
const primaryCancerConditionVSFilepath = path.resolve(__dirname, 'valueSets', 'ValueSet-mcode-primary-or-uncertain-behavior-cancer-disorder-vs.json');
2828
return checkCodeInVs(code, primaryCancerConditionVSFilepath);
2929
}
3030

@@ -34,7 +34,7 @@ function isConditionCodePrimary(code) {
3434
* @return {boolean} if secondary cancer condition
3535
*/
3636
function isConditionCodeSecondary(code) {
37-
const secondaryCancerConditionVSFilepath = path.resolve(__dirname, './valueSets/ValueSet-mcode-secondary-cancer-disorder-vs.json');
37+
const secondaryCancerConditionVSFilepath = path.resolve(__dirname, 'valueSets', 'ValueSet-mcode-secondary-cancer-disorder-vs.json');
3838
return checkCodeInVs(code, secondaryCancerConditionVSFilepath);
3939
}
4040

src/helpers/observationUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const vitalSignsCodeToTextLookup = {
2020

2121

2222
function isTumorMarker(code) {
23-
const tumorMarkerTestVSPath = path.resolve(__dirname, './valueSets/ValueSet-mcode-tumor-marker-test-vs.json');
23+
const tumorMarkerTestVSPath = path.resolve(__dirname, 'valueSets', 'ValueSet-mcode-tumor-marker-test-vs.json');
2424
return checkCodeInVs(code, tumorMarkerTestVSPath);
2525
}
2626

src/helpers/valueSetUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const checkCodeInVs = (code, valueSetFilePath, typeOfVS = vsTypes.json) => {
4646
let inVSExpansion = false;
4747
let inVSCompose = false;
4848
if (valueSet.expansion) {
49-
// If valueSet has expansion, we only need to check these codes since everything in compose is in expansion
49+
// If valueSet has expansion, we only need to check these codes
5050
inVSExpansion = valueSet.expansion.contains.some((containsItem) => {
5151
if (!code || !containsItem) return false;
5252
// return code.system === containsItem.system && code === containsItem.code;

test/helpers/valueSetUtils.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('valueSetUtils', () => {
2323
expect(() => loadJsonVs('./path/does/not/exist')).toThrow();
2424
});
2525
test('should load from the supplied filepath', () => {
26-
const valueSetFilePath = path.resolve(__dirname, './fixtures/valueset-without-expansion.json');
26+
const valueSetFilePath = path.resolve(__dirname, 'fixtures', 'valueset-without-expansion.json');
2727
expect(loadJsonVs(valueSetFilePath)).toEqual(exampleValueSet);
2828
});
2929
});
@@ -39,17 +39,17 @@ describe('valueSetUtils', () => {
3939
expect(() => loadVs(undefined, vsTypes.newType)).toThrow();
4040
});
4141
test('Should load a vs properly for json', () => {
42-
const valueSetFilePath = path.resolve(__dirname, './fixtures/valueset-without-expansion.json');
43-
expect(loadJsonVs(valueSetFilePath, vsTypes.json)).toEqual(exampleValueSet);
42+
const valueSetFilePath = path.resolve(__dirname, 'fixtures', 'valueset-without-expansion.json');
43+
expect(loadVs(valueSetFilePath, vsTypes.json)).toEqual(exampleValueSet);
4444
});
4545
});
4646

4747
describe('checkCodeInVs', () => {
4848
const includesCode = 'C00.0';
4949
const expansionCode = 'C00.1';
5050
const missingCode = 'C12.34';
51-
const vsPath = path.resolve(__dirname, './fixtures/valueset-without-expansion.json');
52-
const vsWithExpansionPath = path.resolve(__dirname, './fixtures/valueset-with-expansion.json');
51+
const vsPath = path.resolve(__dirname, 'fixtures', 'valueset-without-expansion.json');
52+
const vsWithExpansionPath = path.resolve(__dirname, 'fixtures', 'valueset-with-expansion.json');
5353
test('Should throw when not provided a vs', () => {
5454
expect(() => checkCodeInVs(includesCode, undefined)).toThrow();
5555
});

0 commit comments

Comments
 (0)