From d064f5ba5cc2fa592c0e7566560b05e9c4ed65dc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 24 Feb 2024 15:47:19 -0300 Subject: Normalize how modules import and name each other Also add a `defaultInterceptors` variable in `src/hero.mjs` to avoid needing to redefine it in every application. --- tests/js/accretion.mjs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'tests/js/accretion.mjs') diff --git a/tests/js/accretion.mjs b/tests/js/accretion.mjs index 3ea90c3..a0fbb66 100644 --- a/tests/js/accretion.mjs +++ b/tests/js/accretion.mjs @@ -2,27 +2,29 @@ import assert from "node:assert/strict"; import sqlite from "../../src/sqlite.cjs"; -import { runTests } from "../runner.mjs"; -import { promisifyDb, open } from "../../src/db.mjs"; -import { runMigrations } from "../../src/accretion.mjs"; +import * as runner from "../runner.mjs"; +import * as db from "../../src/db.mjs"; +import { + runMigrations, +} from "../../src/accretion.mjs"; const test_runMigrations = t => { t.start("runMigrations()"); t.test("running twice is a noop", async () => { - const db = await open(":memory:"); - const migrationsFn = () => db.all("SELECT filename FROM migrations;"); + 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(db); + await runMigrations(handle); const filled = await migrationsFn(); - await runMigrations(db); + await runMigrations(handle); const unchanged = await migrationsFn(); assert.deepEqual(filled, unchanged); @@ -30,6 +32,6 @@ const test_runMigrations = t => { }; -await runTests([ +await runner.runTests([ test_runMigrations, ]); -- cgit v1.2.3