testing/schema_ready_fixture.ts view source
(options: SyncExpectedSchemaFixtureOptions): Promise<SyncExpectedSchemaFixtureResult> import {sync_expected_schema_fixture} from '@fuzdev/fuz_app/testing/schema_ready_fixture.js'; Introspect the live (bootstrapped) DB's columns, write them to the committed
fixture when update, then read the committed fixture back. The caller
asserts deepEqual(live, committed):
const {live, committed} = await sync_expected_schema_fixture({
db,
fixture_url: new URL('../../lib/server/expected_schema.json', import.meta.url),
update: process.env.UPDATE_SCHEMA_READY === '1',
});
assert.deepEqual(live, committed);When update writes the fixture it emits raw JSON.stringify (one array
element per line); Prettier collapses short arrays inline, so run gro format
after UPDATE_SCHEMA_READY=1 before committing or the format check will flag
the regenerated file. (The content is identical either way — the regen test
compares values, not formatting.)
options
returns
Promise<SyncExpectedSchemaFixtureResult> the live column map and the committed map (post-write when update)