2025-03-02 20:43:01 +02:00
|
|
|
import { describe, expect, it } from "vitest";
|
2025-03-02 19:39:06 +02:00
|
|
|
import cls from "./cls.js";
|
|
|
|
|
|
|
|
describe("Migration", () => {
|
|
|
|
it("migrates from v214", async () => {
|
2025-03-02 20:43:01 +02:00
|
|
|
await new Promise<void>((resolve) => {
|
2025-03-02 19:39:06 +02:00
|
|
|
cls.init(async () => {
|
2025-04-28 18:40:24 +03:00
|
|
|
await import("../app.js");
|
|
|
|
|
|
|
|
const sql = (await (import("./sql.js"))).default;
|
2025-04-18 17:07:23 +03:00
|
|
|
sql.rebuildIntegrationTestDatabase("spec/db/document_v214.db");
|
2025-04-28 18:40:24 +03:00
|
|
|
|
|
|
|
const migration = (await import("./migration.js")).default;
|
2025-03-02 19:39:06 +02:00
|
|
|
await migration.migrateIfNecessary();
|
2025-03-02 20:43:01 +02:00
|
|
|
expect(sql.getValue("SELECT count(*) FROM blobs")).toBe(116);
|
2025-03-02 19:39:06 +02:00
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
});
|
2025-06-04 22:36:51 +03:00
|
|
|
}, 60_000);
|
2025-03-02 19:39:06 +02:00
|
|
|
});
|