Skip to content

Commit 95e5b12

Browse files
committed
fixed contract break with conditionUtils and checkCodeInVs function
1 parent fe873b5 commit 95e5b12

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/helpers/valueSetUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function loadVs(absoluteFilepath, typeOfVS) {
4343
* @return {boolean} true if condition is in valueSet's compose block or expansion block
4444
*/
4545
const checkCodeInVs = (code, valueSetFilePath, typeOfVS = vsTypes.json) => {
46-
if (_.isUndefined(code)) throw Error('checkCodeInVs received a code of undefined');
4746
const valueSet = loadVs(valueSetFilePath, typeOfVS);
4847
let inVSExpansion = false;
4948
let inVSCompose = false;

test/helpers/valueSetUtils.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ describe('valueSetUtils', () => {
5555
test('Should throw when not provided a vs', () => {
5656
expect(() => checkCodeInVs(includesCode, undefined)).toThrow();
5757
});
58-
test('Should throw when not provided a code', () => {
59-
expect(() => checkCodeInVs(undefined, vsPath)).toThrow();
58+
test('Should return false when not provided a code', () => {
59+
// Note: This was the expected behavior of codesystem lookups before this separate module was created;
60+
// could be an opportunity for refactoring in the future, but not feasible to check now.
61+
expect(checkCodeInVs(undefined, vsPath)).toBeFalsy();
6062
});
6163
test('Should return true if the code is in the VS includes', () => {
6264
expect(checkCodeInVs(includesCode, vsPath, vsTypes.json)).toBeTruthy();

0 commit comments

Comments
 (0)