feat(domain): sheet document schema v2 — references registry, review_status, vertebral count_range; SQL gate + pgTAP 008
This commit is contained in:
1 parent
6c5b2b7754
commit
3dbbfdf1df
19 files changed
+474
-71
No files matched your search
@@ -32,6 +32,7 @@ function point(id: string, fields: Partial<Annotation> = {}): Annotation {
|
||||
category_id: 'articulations',
|
||||
laterality: 'bilateral',
|
||||
geometry: null,
|
||||
review_status: 'inherited',
|
||||
name: { fr: id, en: id },
|
||||
finding_zone_id: 'hip',
|
||||
vertebral_region_code: null,
|
||||
@@ -47,6 +48,7 @@ function trigger(id: string, viewId: string, opensViewId: string) {
|
||||
category_id: 'cadrans-du-crane',
|
||||
laterality: 'unpaired',
|
||||
geometry: null,
|
||||
review_status: 'inherited',
|
||||
name: null,
|
||||
opens_view_id: opensViewId,
|
||||
} satisfies Annotation
|
||||
@@ -284,6 +286,49 @@ describe('integrity rules (one mutation per code)', () => {
|
||||
expect(issuesOf(doc)).toEqual([])
|
||||
})
|
||||
|
||||
it('reference.id.duplicate', () => {
|
||||
const doc = mutated((d) => {
|
||||
d.references.push(structuredClone(d.references[0]))
|
||||
})
|
||||
expect(issuesOf(doc)).toEqual([
|
||||
['reference.id.duplicate', 'references[1].id'],
|
||||
])
|
||||
})
|
||||
|
||||
it('finding.reference.missing on a category and on a nested node', () => {
|
||||
const doc = mutated((d) => {
|
||||
const hip = d.finding_zones[0].categories
|
||||
hip[0].reference_ids = ['nav-2017']
|
||||
hip[0].children[0].children[0].reference_ids = ['legacy-catalog', 'x']
|
||||
})
|
||||
expect(issuesOf(doc)).toEqual([
|
||||
[
|
||||
'finding.reference.missing',
|
||||
'finding_zones[0].categories[0].reference_ids[0]',
|
||||
],
|
||||
[
|
||||
'finding.reference.missing',
|
||||
'finding_zones[0].categories[0].children[0].children[0].reference_ids[1]',
|
||||
],
|
||||
])
|
||||
})
|
||||
|
||||
it('region.count_range.invalid when count sits outside the range', () => {
|
||||
const doc = mutated((d) => {
|
||||
d.vertebral_config.regions[4].count_range = { min: 19, max: 21 }
|
||||
})
|
||||
expect(issuesOf(doc)).toEqual([
|
||||
['region.count_range.invalid', 'vertebral_config.regions[4].count_range'],
|
||||
])
|
||||
})
|
||||
|
||||
it('region.count_range accepts count on the bounds', () => {
|
||||
const doc = mutated((d) => {
|
||||
d.vertebral_config.regions[4].count_range = { min: 18, max: 18 }
|
||||
})
|
||||
expect(issuesOf(doc)).toEqual([])
|
||||
})
|
||||
|
||||
it('finding_zone.unreferenced is a warning', () => {
|
||||
const doc = mutated((d) => {
|
||||
d.finding_zones.push({
|
||||
|
||||
Reference in new issue
Block a user