mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
feat(dares): seed 150-item catalogue
This commit is contained in:
1 parent
d998e32047
commit
439f506fff
5 files changed
+506
-1
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { readdir, readFile } from 'node:fs/promises';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
interface JournalEntry {
|
||||
idx: number;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
describe('Drizzle migration journal', () => {
|
||||
it('lists every ordered SQL migration exactly once', async () => {
|
||||
const migrationsDirectory = new URL('../drizzle/', import.meta.url);
|
||||
const journal = JSON.parse(await readFile(new URL('meta/_journal.json', migrationsDirectory), 'utf8')) as {
|
||||
entries: JournalEntry[];
|
||||
};
|
||||
const migrationFiles = (await readdir(migrationsDirectory))
|
||||
.filter((name) => name.endsWith('.sql'))
|
||||
.sort();
|
||||
const journalFiles = journal.entries.map((entry) => `${entry.tag}.sql`);
|
||||
|
||||
expect(journal.entries.map((entry) => entry.idx)).toEqual([...journal.entries.keys()]);
|
||||
expect(new Set(journalFiles).size).toBe(journalFiles.length);
|
||||
expect(journalFiles).toEqual(migrationFiles);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user