Skip to content

Commit 30b6591

Browse files
committed
Fix contained-reference smoke assertion
The pre-existing validatorCodes helper maps issues as code:expr without a severity prefix. Assert the unresolved contained reference is an error via the summary and issue severity instead of a severity-prefixed code string.
1 parent aa95dbe commit 30b6591

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

plugins/records/scripts/smoke-test.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,10 @@ if (!reqChoiceMissing.codes?.some((entry) => entry.includes("required:Medication
438438
const reqChoicePresent = validatorCodes([], '{"resourceType":"MedicationRequest","id":"m","status":"active","intent":"order","subject":{"reference":"Patient/p"},"medicationCodeableConcept":{}}');
439439
if (reqChoicePresent.codes?.some((entry) => entry.includes("MedicationRequest.medication[x]"))) errors.push("Validator should accept a satisfied medication[x] choice.");
440440

441-
const containedMissing = validatorCodes([], '{"resourceType":"Observation","status":"final","code":{},"subject":{"reference":"#p1"}}');
442-
if (!containedMissing.codes?.some((entry) => entry.startsWith("error:not-found:"))) errors.push("Validator should flag an unresolved contained reference as an error.");
441+
const containedMissing = runValidator([], '{"resourceType":"Observation","status":"final","code":{},"subject":{"reference":"#p1"}}');
442+
if (containedMissing.parsed?.summary.error !== 1 || !containedMissing.parsed?.operationOutcome.issue.some((entry) => entry.severity === "error" && entry.code === "not-found")) {
443+
errors.push("Validator should flag an unresolved contained reference as an error.");
444+
}
443445
const bundleUnresolved = runValidator([], '{"resourceType":"Bundle","type":"collection","entry":[{"resource":{"resourceType":"Observation","status":"final","code":{},"subject":{"reference":"Patient/missing"}}}]}');
444446
if (bundleUnresolved.parsed?.summary.warning !== 1 || bundleUnresolved.status !== 0) errors.push("Validator should warn (not error) on an unresolved intra-Bundle reference.");
445447
const bundleResolved = runValidator([], '{"resourceType":"Bundle","type":"collection","entry":[{"resource":{"resourceType":"Patient","id":"p"}},{"resource":{"resourceType":"Observation","status":"final","code":{},"subject":{"reference":"Patient/p"}}}]}');

0 commit comments

Comments
 (0)