fix(pdf,tests): report:compare escapes control characters, prints names and free text only with --full, stats before read, missing file as a per-file failure; inferRegionCode regression test; import.ts JSDoc reattached
This commit is contained in:
1 parent
dc78a00835
commit
b1b3e4927e
6 files changed
+257
-72
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { inferRegionCode } from '../src/legacy/regions'
|
||||
|
||||
const code = (fr: string | null, en: string | null = null) =>
|
||||
inferRegionCode(fr, en)?.code
|
||||
|
||||
describe('inferRegionCode', () => {
|
||||
it('matches FR roots, with and without accents', () => {
|
||||
expect(code('Vertèbres cervicales')).toBe('C')
|
||||
expect(code('Vertebres cervicales')).toBe('C')
|
||||
expect(code('Vertèbres thoraciques')).toBe('T')
|
||||
expect(code('Vertebres thoraciques')).toBe('T')
|
||||
expect(code('Vertèbres lombaires')).toBe('L')
|
||||
expect(code('Vertèbres sacrales')).toBe('S')
|
||||
expect(code('Vertèbres sacrées')).toBe('S')
|
||||
expect(code('Vertèbres caudales')).toBe('Cd')
|
||||
expect(code('Vertèbres coccygiennes')).toBe('Cd')
|
||||
expect(code('Région dorsale')).toBe('T')
|
||||
})
|
||||
|
||||
it('matches EN roots when the FR label is absent', () => {
|
||||
expect(code(null, 'Cervical Vertebrae')).toBe('C')
|
||||
expect(code(null, 'Thoracic Vertebrae')).toBe('T')
|
||||
expect(code(null, 'Lumbar Vertebrae')).toBe('L')
|
||||
expect(code(null, 'Sacral Vertebrae')).toBe('S')
|
||||
expect(code(null, 'Coccygeal Vertebrae')).toBe('Cd')
|
||||
})
|
||||
|
||||
it('returns null when no root matches', () => {
|
||||
expect(inferRegionCode('Épaule', 'Shoulder')).toBeNull()
|
||||
expect(inferRegionCode('', '')).toBeNull()
|
||||
expect(inferRegionCode(null, null)).toBeNull()
|
||||
})
|
||||
|
||||
it('reports the matched root and label, FR before EN', () => {
|
||||
expect(inferRegionCode('Vertèbres lombaires', 'Cervical')).toEqual({
|
||||
code: 'L',
|
||||
root: 'lombair',
|
||||
label: 'Vertèbres lombaires',
|
||||
})
|
||||
expect(code('Épaule', 'Cervical Vertebrae')).toBe('C')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user