File
Blob: tests/worker/runtime.test.ts
| 1 | import { describe, expect, it } from "vitest"; |
| 2 | |
| 3 | import d1MigrationJournal from "../../drizzle/d1/meta/_journal.json"; |
| 4 | |
| 5 | import { readAppD1Migrations } from "../helpers/runtime"; |
| 6 | |
| 7 | describe("test runtime helpers", () => { |
| 8 | it("loads D1 migrations from the drizzle journal", () => { |
| 9 | const migrations = readAppD1Migrations(); |
| 10 | |
| 11 | expect(migrations).toHaveLength(d1MigrationJournal.entries.length); |
| 12 | expect(migrations.map((migration) => migration.name)).toEqual( |
| 13 | d1MigrationJournal.entries.map((entry) => `${entry.tag}.sql`), |
| 14 | ); |
| 15 | expect(migrations.every((migration) => migration.queries.length > 0)).toBe(true); |
| 16 | }); |
| 17 | }); |