diff options
author | EuAndreh <eu@euandre.org> | 2024-03-25 06:42:35 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-03-25 06:44:18 -0300 |
commit | 077b81b2bd2c0d418635b265b35f582d68cec16a (patch) | |
tree | ed3c928ea3b1d5df539b6e1902ab418caa937672 /tests/js/accretion.mjs | |
parent | src/hero.mjs: Retire code (diff) | |
download | papod-077b81b2bd2c0d418635b265b35f582d68cec16a.tar.gz papod-077b81b2bd2c0d418635b265b35f582d68cec16a.tar.xz |
Node.js -> Go
Diffstat (limited to 'tests/js/accretion.mjs')
-rw-r--r-- | tests/js/accretion.mjs | 48 |
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, -]); |