The 21 rules of validateSheetDocument ported with identical codes, severities, paths and messages (frozen from the TypeScript on 26 conformance fixtures), createEmptySheetDocument, the publish check (strict shape then rules), and the index data React reads once (positions with Map semantics, names, spine ids, finding-path keys). The fixtures also carry the codes private.sheet_document_issues returns: a cargo test generates supabase/tests/011_sheet_conformance.sql and refuses drift (PGlite 12/12 files, real stack 446/446). .prettierignore keeps the byte-exact oracles and generated fixtures out of pnpm format.
27 lines
953 B
TypeScript
27 lines
953 B
TypeScript
/**
|
|
* R2: the horse slice fixture as JSON for the Rust suites (crates/core/tests/fixtures),
|
|
* written from the TypeScript fixture with `MAKE_R2_ORACLES=1`, asserted otherwise.
|
|
*/
|
|
import { readFileSync, writeFileSync } from 'node:fs'
|
|
import { dirname, resolve } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { HORSE_MAIN_ASSET_ID, horseSliceInput } from './fixtures/horse-slice'
|
|
|
|
const FILE = resolve(
|
|
dirname(fileURLToPath(import.meta.url)),
|
|
'../../../crates/core/tests/fixtures/horse-slice.json',
|
|
)
|
|
|
|
describe('horse slice JSON fixture', () => {
|
|
it('equals the TypeScript lean input', () => {
|
|
const fixture = {
|
|
mainAssetId: HORSE_MAIN_ASSET_ID,
|
|
input: horseSliceInput(),
|
|
}
|
|
const text = `${JSON.stringify(fixture, null, 2)}\n`
|
|
if (process.env.MAKE_R2_ORACLES === '1') writeFileSync(FILE, text)
|
|
expect(readFileSync(FILE, 'utf8')).toBe(text)
|
|
})
|
|
})
|