summaryrefslogtreecommitdiff
path: root/tests/js/accretion.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/js/accretion.mjs')
-rw-r--r--tests/js/accretion.mjs48
1 files changed, 0 insertions, 48 deletions
diff --git a/tests/js/accretion.mjs b/tests/js/accretion.mjs
deleted file mode 100644
index c6ec4b2..0000000
--- a/tests/js/accretion.mjs
+++ /dev/null
@@ -1,48 +0,0 @@
-import assert from "node:assert/strict";
-import fs from "node:fs";
-
-import sqlite from "../../src/sqlite.cjs";
-
-import * as runner from "../runner.mjs";
-import * as db from "../../src/db.mjs";
-import * as u from "../../src/utils.mjs";
-import {
- MIGRATIONS_DIR,
- runMigrations,
-} from "../../src/accretion.mjs";
-
-
-const test_runMigrations = async t => {
- t.start("runMigrations()");
-
- await t.test("running twice is a noop", async () => {
- const contents = [];
- const logFn = x => contents.push(x);
- const handle = await db.open(":memory:");
- const migrationsFn = () => handle.all("SELECT filename FROM migrations;");
-
- assert.rejects(
- migrationsFn,
- { message: "SQLITE_ERROR: no such table: migrations" },
- );
-
- await runMigrations(logFn, handle);
- const filled = await migrationsFn();
-
- await runMigrations(logFn, handle);
- const unchanged = await migrationsFn();
-
- assert.deepEqual(filled, unchanged);
-
- const migrationLogs = fs
- .readdirSync(MIGRATIONS_DIR)
- .sort(u.strSortFn)
- .map(filename => ({ log: "exec-migration", filename }));
- assert.deepEqual(contents, migrationLogs);
- });
-};
-
-
-await runner.runTests([
- test_runMigrations,
-]);