Skip to content

Commit 85c469a

Browse files
committed
updated the staging extractor tests to add this new stagingSystem property
1 parent 2051694 commit 85c469a

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

test/templates/fixtures/maximal-staging-resource.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
"http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-clinical-stage-group"
77
]
88
},
9+
"method": {
10+
"coding": [
11+
{
12+
"code": "443830009",
13+
"system": "http://snomed.info/sct"
14+
}
15+
]
16+
},
917
"status": "final",
1018
"category": [
1119
{
@@ -53,4 +61,4 @@
5361
"reference": "urn:uuid:m-category-id"
5462
}
5563
]
56-
}
64+
}

test/templates/staging.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('JavaScript render Staging template', () => {
1414
effectiveDateTime: '2020-01-01',
1515
stageGroup: '3C',
1616
type: 'Clinical',
17+
stagingSystem: null,
1718
categoryIds: null,
1819
};
1920

@@ -23,17 +24,18 @@ describe('JavaScript render Staging template', () => {
2324
});
2425

2526
test('minimal pathologic required data passed into template should generate FHIR resource', () => {
26-
const STAGING_CLINICAL_MINIMAL_DATA = {
27+
const STAGING_PATHOLOGIC_MINIMAL_DATA = {
2728
id: 'example-id',
2829
subjectId: 'example-mrn',
2930
conditionId: 'example-condition-id',
3031
effectiveDateTime: '2020-01-01',
3132
stageGroup: '3C',
3233
type: 'Pathologic',
34+
stagingSystem: null,
3335
categoryIds: null,
3436
};
3537

36-
const generatedStaging = stagingTemplate(STAGING_CLINICAL_MINIMAL_DATA);
38+
const generatedStaging = stagingTemplate(STAGING_PATHOLOGIC_MINIMAL_DATA);
3739
expect(generatedStaging).toEqual(minimalStagingPathologicResource);
3840
expect(isValidFHIR(generatedStaging)).toBeTruthy();
3941
});
@@ -46,6 +48,7 @@ describe('JavaScript render Staging template', () => {
4648
effectiveDateTime: '2020-01-01',
4749
type: 'Clinical',
4850
stageGroup: '3C',
51+
stagingSystem: '443830009',
4952
categoryIds: ['t-category-id', 'n-category-id', 'm-category-id'],
5053
};
5154

@@ -65,6 +68,7 @@ describe('JavaScript render Staging template', () => {
6568
};
6669

6770
const OPTIONAL_DATA = {
71+
stagingSystem: '443830009',
6872
categoryIds: ['t-category-id', 'n-category-id', 'm-category-id'],
6973
};
7074

@@ -74,11 +78,14 @@ describe('JavaScript render Staging template', () => {
7478
test('missing required data should throw an error', () => {
7579
const INVALID_DATA = {
7680
// Omitting 'effectiveDateTime' field which is a required property
81+
effectiveDateTime: null,
7782
id: 'example-id',
7883
subjectId: 'example-mrn',
7984
conditionId: 'example-condition-id',
8085
type: 'Clinical',
81-
effectiveDateTime: null,
86+
stageGroup: '3C',
87+
stagingSystem: '443830009',
88+
categoryIds: ['t-category-id', 'n-category-id', 'm-category-id'],
8289
};
8390

8491
expect(() => stagingTemplate(INVALID_DATA)).toThrow(Error);

0 commit comments

Comments
 (0)