-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure getReferenceKey tests so they don't mention key values
closes #202 Co-authored-by: spicyfalafel <[email protected]>
- Loading branch information
1 parent
801d24a
commit 2cb3506
Showing
5 changed files
with
184 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { describe } from 'bun:test' | ||
import { add_test, end_case, start_case } from './test_helpers' | ||
|
||
const resources = [ | ||
{ | ||
resourceType: "Patient", | ||
id: "p1", | ||
link: [ | ||
{ | ||
other: { | ||
reference: "Patient/p1" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
start_case('fn_reference_keys', 'TBD', resources) | ||
|
||
describe('getReferenceKey result matches getResourceKey', () => { | ||
add_test({ | ||
title: "getReferenceKey result matches getResourceKey without type specifier", | ||
view: { | ||
resource: "Patient", | ||
select: [ | ||
{ | ||
column: [ | ||
{ | ||
path: "getResourceKey() = link.other.getReferenceKey()", | ||
name: "key_equal_ref" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
expect: [ | ||
{ | ||
key_equal_ref: true | ||
} | ||
] | ||
}) | ||
|
||
add_test({ | ||
title: "getReferenceKey result matches getResourceKey with right type specifier", | ||
view: { | ||
resource: "Patient", | ||
select: [ | ||
{ | ||
column: [ | ||
{ | ||
path: "getResourceKey() = link.other.getReferenceKey(Patient)", | ||
name: "key_equal_ref" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
expect: [ | ||
{ | ||
key_equal_ref: true | ||
} | ||
] | ||
}) | ||
|
||
add_test({ | ||
title: "getReferenceKey result matches getResourceKey with wrong type specifier", | ||
view: { | ||
resource: "Patient", | ||
select: [ | ||
{ | ||
column: [ | ||
{ | ||
path: "link.other.getReferenceKey(Observation)", | ||
name: "referenceKey" | ||
}, | ||
{ | ||
path: "getResourceKey() = link.other.getReferenceKey(Observation)", | ||
name: "key_equal_ref" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
expect: [ | ||
{ | ||
referenceKey: null, | ||
key_equal_ref: null | ||
} | ||
] | ||
}) | ||
|
||
end_case() | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"title": "fn_reference_keys", | ||
"description": "TBD", | ||
"resources": [ | ||
{ | ||
"resourceType": "Patient", | ||
"id": "p1", | ||
"link": [ | ||
{ | ||
"other": { | ||
"reference": "Patient/p1" | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"tests": [ | ||
{ | ||
"title": "getReferenceKey result matches getResourceKey without type specifier", | ||
"view": { | ||
"resource": "Patient", | ||
"select": [ | ||
{ | ||
"column": [ | ||
{ | ||
"path": "getResourceKey() = link.other.getReferenceKey()", | ||
"name": "key_equal_ref" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"expect": [ | ||
{ | ||
"key_equal_ref": true | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "getReferenceKey result matches getResourceKey with right type specifier", | ||
"view": { | ||
"resource": "Patient", | ||
"select": [ | ||
{ | ||
"column": [ | ||
{ | ||
"path": "getResourceKey() = link.other.getReferenceKey(Patient)", | ||
"name": "key_equal_ref" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"expect": [ | ||
{ | ||
"key_equal_ref": true | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "getReferenceKey result matches getResourceKey with wrong type specifier", | ||
"view": { | ||
"resource": "Patient", | ||
"select": [ | ||
{ | ||
"column": [ | ||
{ | ||
"path": "link.other.getReferenceKey(Observation)", | ||
"name": "referenceKey" | ||
}, | ||
{ | ||
"path": "getResourceKey() = link.other.getReferenceKey(Observation)", | ||
"name": "key_equal_ref" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"expect": [ | ||
{ | ||
"referenceKey": null, | ||
"key_equal_ref": null | ||
} | ||
] | ||
} | ||
] | ||
} |