feat(domain): archive contracts — sheet snapshot (lean document, caps, integrity), envelope v1 layered reader, branding and label schemas, report rebase, sheet index moved from the app; bundle carries asset hashes
This commit is contained in:
1 parent
8b86b926c8
commit
cdc0943f35
25 files changed
+2253
-116
No files matched your search
@@ -2,6 +2,8 @@
|
||||
* Replaces anatomy.horse / char.svgCatalogLink: the bundled reference sheet
|
||||
* loads, validates, and indexes as the canonical document says.
|
||||
*/
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { beforeAll, describe, expect, it } from 'vitest'
|
||||
import { bundledSheetProvider } from '@/sheets/provider'
|
||||
import {
|
||||
@@ -12,6 +14,12 @@ import {
|
||||
} from '@/services/sheetIndex'
|
||||
import { loadTestSheet } from '../helpers/sheet'
|
||||
|
||||
/** The seed manifest the bundle reads its asset hashes from. */
|
||||
const ASSET_MANIFEST = resolve(
|
||||
__dirname,
|
||||
'../../../../supabase/seed/anatomical-sheets/equine/draft/assets.json',
|
||||
)
|
||||
|
||||
let sheet: SheetIndex
|
||||
beforeAll(async () => {
|
||||
sheet = await loadTestSheet()
|
||||
@@ -32,6 +40,19 @@ describe('bundled sheet provider', () => {
|
||||
)
|
||||
expect(await bundledSheetProvider.getReferenceSheet('canine')).toBeNull()
|
||||
})
|
||||
|
||||
it('carries the schema version and the manifest hash of the horse asset', async () => {
|
||||
const loaded = await bundledSheetProvider.getReferenceSheet('equine')
|
||||
const manifest = JSON.parse(readFileSync(ASSET_MANIFEST, 'utf8')) as {
|
||||
sha256: string
|
||||
svg_asset_id: string
|
||||
}[]
|
||||
const horse = manifest[0]!
|
||||
expect(loaded!.schemaVersion).toBe(2)
|
||||
expect(Object.keys(loaded!.assetHashes)).toEqual([horse.svg_asset_id])
|
||||
expect(loaded!.assetHashes[horse.svg_asset_id]).toBe(horse.sha256)
|
||||
expect(horse.sha256).toMatch(/^[0-9a-f]{64}$/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('sheet index', () => {
|
||||
@@ -93,9 +114,12 @@ describe('sheet index', () => {
|
||||
.filter(isObservable)
|
||||
.map((a) => a.vertebral_region_code)
|
||||
.filter((c) => c !== null)
|
||||
expect(sheet.regions().map((r) => r.code).sort()).toEqual(
|
||||
[...carried].sort(),
|
||||
)
|
||||
expect(
|
||||
sheet
|
||||
.regions()
|
||||
.map((r) => r.code)
|
||||
.sort(),
|
||||
).toEqual([...carried].sort())
|
||||
})
|
||||
|
||||
it('resolves finding paths and reports absent ones', () => {
|
||||
|
||||
Reference in new issue
Block a user