summaryrefslogtreecommitdiff
path: root/tests/js/accretion.mjs
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-25 06:42:35 -0300
committerEuAndreh <eu@euandre.org>2024-03-25 06:44:18 -0300
commit077b81b2bd2c0d418635b265b35f582d68cec16a (patch)
treeed3c928ea3b1d5df539b6e1902ab418caa937672 /tests/js/accretion.mjs
parentsrc/hero.mjs: Retire code (diff)
downloadpapod-077b81b2bd2c0d418635b265b35f582d68cec16a.tar.gz
papod-077b81b2bd2c0d418635b265b35f582d68cec16a.tar.xz
Node.js -> Go
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,
-]);