test(app): former PDF, observation card, route and schema assertions restored on v3; foreign JSON attachment reported as no_attachment; doc counts

This commit is contained in:
bchanot committed 2026-10-10 12:21:19 +02:00
1 parent 06a2e86f3c
commit 17a6d9b323
9 files changed
+406 -27

No files matched your search

+27 -3
View File
@@ -69,9 +69,9 @@ describe('report v3 leaf schemas', () => {
it('ObservationSchema rejects an empty id', () => {
expect(ObservationSchema.safeParse(observation).success).toBe(true)
expect(ObservationSchema.safeParse({ ...observation, id: '' }).success).toBe(
false,
)
expect(
ObservationSchema.safeParse({ ...observation, id: '' }).success,
).toBe(false)
})
it('SeveritySchema accepts the three codes only', () => {
@@ -116,3 +116,27 @@ describe('report v3 document and identity', () => {
)
})
})
describe('report v3 permissive boundaries', () => {
it('strips unknown keys silently', () => {
const out = ReportSchema.parse({ ...report, foo: 1 })
expect('foo' in out).toBe(false)
})
it('accepts a vertebra index above any region count (bounds are a sheet concern)', () => {
expect(VertebraSchema.safeParse({ region: 'C', index: 99 }).success).toBe(
true,
)
})
it('accepts an unregistered speciesId', () => {
const animal = { speciesId: 'dragon', name: 'A' }
expect(ReportSchema.safeParse({ ...report, animal }).success).toBe(true)
})
it('accepts orphan findings citing a zone absent from zones (D5)', () => {
const orphan = { ...observation, findings: [finding] }
const out = ReportSchema.safeParse({ ...report, observations: [orphan] })
expect(out.success).toBe(true)
})
})