File size: 841 Bytes
95b671e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import assert from "node:assert/strict";
import { test } from "node:test";
import { shouldRunMigrationsOnBoot } from "./boot-migrations.js";
test("defaults to running migrations on boot when unset", () => {
assert.equal(shouldRunMigrationsOnBoot({} as NodeJS.ProcessEnv), true);
});
test("runs on boot when explicitly enabled", () => {
assert.equal(
shouldRunMigrationsOnBoot({ RUN_MIGRATIONS_ON_BOOT: "true" } as NodeJS.ProcessEnv),
true,
);
});
test("skips boot migrations only when explicitly set to 'false'", () => {
assert.equal(
shouldRunMigrationsOnBoot({ RUN_MIGRATIONS_ON_BOOT: "false" } as NodeJS.ProcessEnv),
false,
);
});
test("any non-'false' value still runs on boot", () => {
assert.equal(
shouldRunMigrationsOnBoot({ RUN_MIGRATIONS_ON_BOOT: "0" } as NodeJS.ProcessEnv),
true,
);
});
|