Skip to content

Commit e505b70

Browse files
NRL-518 Add feature tests for format code display mismatch
1 parent c113df8 commit e505b70

File tree

3 files changed

+187
-0
lines changed

3 files changed

+187
-0
lines changed

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,3 +783,61 @@ Feature: Producer - createDocumentReference - Failure Scenarios
783783
]
784784
}
785785
"""
786+
787+
Scenario: Mismatched format code and display
788+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
789+
And the organisation 'TSTCUS' is authorised to access pointer types:
790+
| system | value |
791+
| http://snomed.info/sct | 736253002 |
792+
When producer 'TSTCUS' requests creation of a DocumentReference with default test values except 'content' is:
793+
"""
794+
"content": [
795+
{
796+
"attachment": {
797+
"contentType": "application/pdf",
798+
"url": "https://example.org/my-doc.pdf"
799+
},
800+
"format": {
801+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
802+
"code": "urn:nhs-ic:record-contact",
803+
"display": "Unstructured Document"
804+
},
805+
"extension": [
806+
{
807+
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability",
808+
"valueCodeableConcept": {
809+
"coding": [
810+
{
811+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLContentStability",
812+
"code": "static",
813+
"display": "Static"
814+
}
815+
]
816+
}
817+
}
818+
]
819+
}
820+
]
821+
"""
822+
Then the response status code is 400
823+
And the response is an OperationOutcome with 1 issue
824+
And the OperationOutcome contains the issue:
825+
"""
826+
{
827+
"severity": "error",
828+
"code": "value",
829+
"details": {
830+
"coding": [
831+
{
832+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
833+
"code": "INVALID_RESOURCE",
834+
"display": "Invalid validation of resource"
835+
}
836+
]
837+
},
838+
"diagnostics": "Invalid display for format code 'urn:nhs-ic:record-contact'. Expected 'Contact details (HTTP Unsecured)'",
839+
"expression": [
840+
"content[0].format.display"
841+
]
842+
}
843+
"""

tests/features/producer/updateDocumentReference-failure.feature

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,74 @@ Feature: Producer - updateDocumentReference - Failure Scenarios
235235
]
236236
}
237237
"""
238+
239+
Scenario: Mismatched format code and display
240+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
241+
And the organisation 'TSTCUS' is authorised to access pointer types:
242+
| system | value |
243+
| http://snomed.info/sct | 736253002 |
244+
And a DocumentReference resource exists with values:
245+
| property | value |
246+
| id | TSTCUS-1114567893-updateDocTest |
247+
| subject | 9999999999 |
248+
| status | current |
249+
| type | 736253002 |
250+
| category | 734163000 |
251+
| contentType | application/pdf |
252+
| url | https://example.org/my-doc.pdf |
253+
| custodian | TSTCUS |
254+
| author | TSTCUS |
255+
When producer 'TSTCUS' requests update of a DocumentReference with pointerId 'TSTCUS-1114567893-updateDocTest' and only changing:
256+
"""
257+
{
258+
"content": [
259+
{
260+
"attachment": {
261+
"contentType": "application/pdf",
262+
"url": "https://example.org/my-doc.pdf"
263+
},
264+
"format": {
265+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
266+
"code": "urn:nhs-ic:record-contact",
267+
"display": "Unstructured Document"
268+
},
269+
"extension": [
270+
{
271+
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability",
272+
"valueCodeableConcept": {
273+
"coding": [
274+
{
275+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLContentStability",
276+
"code": "static",
277+
"display": "Static"
278+
}
279+
]
280+
}
281+
}
282+
]
283+
}
284+
]
285+
}
286+
"""
287+
Then the response status code is 400
288+
And the response is an OperationOutcome with 1 issue
289+
And the OperationOutcome contains the issue:
290+
"""
291+
{
292+
"severity": "error",
293+
"code": "value",
294+
"details": {
295+
"coding": [
296+
{
297+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
298+
"code": "INVALID_RESOURCE",
299+
"display": "Invalid validation of resource"
300+
}
301+
]
302+
},
303+
"diagnostics": "Invalid display for format code 'urn:nhs-ic:record-contact'. Expected 'Contact details (HTTP Unsecured)'",
304+
"expression": [
305+
"content[0].format.display"
306+
]
307+
}
308+
"""

tests/features/producer/upsertDocumentReference-failure.feature

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,61 @@ Feature: Producer - upsertDocumentReference - Failure Scenarios
365365
]
366366
}
367367
"""
368+
369+
Scenario: Mismatched format code and display
370+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
371+
And the organisation 'TSTCUS' is authorised to access pointer types:
372+
| system | value |
373+
| http://snomed.info/sct | 736253002 |
374+
When producer 'TSTCUS' requests upsert of a DocumentReference with pointerId 'TSTCUS-testid-upsert-0001-0001' and default test values except 'content' is:
375+
"""
376+
"content": [
377+
{
378+
"attachment": {
379+
"contentType": "application/pdf",
380+
"url": "https://example.org/my-doc.pdf"
381+
},
382+
"format": {
383+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
384+
"code": "urn:nhs-ic:record-contact",
385+
"display": "Unstructured Document"
386+
},
387+
"extension": [
388+
{
389+
"url": "https://fhir.nhs.uk/England/StructureDefinition/Extension-England-ContentStability",
390+
"valueCodeableConcept": {
391+
"coding": [
392+
{
393+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLContentStability",
394+
"code": "static",
395+
"display": "Static"
396+
}
397+
]
398+
}
399+
}
400+
]
401+
}
402+
]
403+
"""
404+
Then the response status code is 400
405+
And the response is an OperationOutcome with 1 issue
406+
And the OperationOutcome contains the issue:
407+
"""
408+
{
409+
"severity": "error",
410+
"code": "value",
411+
"details": {
412+
"coding": [
413+
{
414+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
415+
"code": "INVALID_RESOURCE",
416+
"display": "Invalid validation of resource"
417+
}
418+
]
419+
},
420+
"diagnostics": "Invalid display for format code 'urn:nhs-ic:record-contact'. Expected 'Contact details (HTTP Unsecured)'",
421+
"expression": [
422+
"content[0].format.display"
423+
]
424+
}
425+
"""

0 commit comments

Comments
 (0)