test(db): keep the legacy upgrade suites on SQLite by name

They boot on a SQLite file the retired positional runner built, which no
Postgres database ever came from, so they belong in SQLITE_ONLY rather
than in the snapshot baseline. The lane scan now tells such a suite apart
from the snapshot mock: it mocks src/db/database onto a database of its
own, never names createSnapshotTestDb, and is named in SQLITE_ONLY with
its reason. A snapshot suite added to SQLITE_ONLY stays in the baseline.
This commit is contained in:
Maurice
2026-11-17 17:55:42 +01:00
parent f11f021e15
commit b0b1986377
4 changed files with 44 additions and 16 deletions
+7 -3
View File
@@ -33,11 +33,14 @@ describe('the Postgres lane', () => {
});
it('PGLANE-002: every SQLite-only exclusion names a suite that would otherwise run on Postgres', () => {
const stale = Object.keys(SQLITE_ONLY).filter((file) => !scan.realDatabase.includes(file));
const stale = Object.keys(SQLITE_ONLY).filter(
(file) => !scan.realDatabase.includes(file) && !scan.ownSqlite.includes(file),
);
expect(
stale,
'These SQLITE_ONLY entries in tests/postgres/lane.ts no longer name a suite that boots the app on the real ' +
'database module (renamed, deleted or rewritten). Remove or rename the entry.',
'database module or on a SQLite database of its own (renamed, deleted or rewritten). Remove or rename ' +
'the entry.',
).toEqual([]);
for (const [file, reason] of Object.entries(SQLITE_ONLY)) {
expect(reason.trim().length, `${file} needs a reason in SQLITE_ONLY`).toBeGreaterThan(20);
@@ -71,7 +74,8 @@ describe('the Postgres lane', () => {
const lane = postgresLane(scan);
expect(lane[0]).toBe('tests/postgres/**/*.test.ts');
const files = lane.slice(1);
expect(files.length).toBe(scan.realDatabase.length - Object.keys(SQLITE_ONLY).length);
expect(files.length).toBe(scan.realDatabase.filter((file) => !(file in SQLITE_ONLY)).length);
for (const file of scan.ownSqlite) expect(files, file).not.toContain(file);
for (const file of files) {
expect(fs.existsSync(path.join(SERVER_ROOT, file)), file).toBe(true);
expect(file in SQLITE_ONLY, file).toBe(false);