Tools live under tools/<role>/<domain> (checks, generate, release, ci, dev), every tool is a workspace named @open-pencil/<domain>-tools, a shared tools/tsconfig.json backs the new check:tools gate that fixed 55 latent type errors, test:tools runs through bun --filter, the placement check is its own checks/test-homes package, and every tool resolves the repository through resolveWorkspaceRoot. Bun, Node, and mdast types live in a tools-root workspace so they never reach the app program.
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
|
|
import { parseRecording } from '../src/recording'
|
|
|
|
describe('navigation recording validation', () => {
|
|
test('rejects negative sample timestamps', () => {
|
|
expect(() =>
|
|
parseRecording({
|
|
schemaVersion: 1,
|
|
name: 'negative',
|
|
source: 'synthetic',
|
|
recordedAt: '',
|
|
environment: {},
|
|
initialViewport: { panX: 0, panY: 0, zoom: 1 },
|
|
trace: [],
|
|
wheel: [{ timeMs: -1, deltaX: 0, deltaY: 1, deltaMode: 0, clientX: 0, clientY: 0 }]
|
|
})
|
|
).toThrow()
|
|
})
|
|
|
|
test('normalizes legacy schema-v1 renderer names', () => {
|
|
const recording = parseRecording({
|
|
schemaVersion: 1,
|
|
name: 'legacy',
|
|
source: 'synthetic',
|
|
recordedAt: '',
|
|
environment: {},
|
|
sceneRenderer: 'existing',
|
|
initialViewport: { panX: 0, panY: 0, zoom: 1 },
|
|
trace: [],
|
|
wheel: []
|
|
})
|
|
|
|
expect(recording.sceneRenderer).toBe('retained')
|
|
})
|
|
|
|
test('rejects unordered samples', () => {
|
|
expect(() =>
|
|
parseRecording({
|
|
schemaVersion: 1,
|
|
name: 'bad',
|
|
source: 'synthetic',
|
|
recordedAt: '',
|
|
environment: {},
|
|
sceneRenderer: 'retained',
|
|
initialViewport: { panX: 0, panY: 0, zoom: 1 },
|
|
trace: [],
|
|
wheel: [
|
|
{ timeMs: 2, deltaX: 0, deltaY: 1, deltaMode: 0, clientX: 0, clientY: 0 },
|
|
{ timeMs: 1, deltaX: 0, deltaY: 1, deltaMode: 0, clientX: 0, clientY: 0 }
|
|
]
|
|
})
|
|
).toThrow('ordered')
|
|
})
|
|
})
|