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). gro format leaves JSON untouched and the regen test compares values, not
formatting, so the layout is cosmetic.
options
returns
Promise<SyncExpectedSchemaFixtureResult>
the live column map and the committed map (post-write when update)