import { test } from "node:test"; import assert from "node:assert/strict"; import { IDLE_BOOT_ENV, isIdleBoot } from "./idleBoot"; // Run with: pnpm --filter yt-dlp-transcript-common exec tsx --test common/lib/idleBoot.test.ts test("an unset variable keeps the host default: arm everything", () => { assert.equal(isIdleBoot({}), false); }); test("the affirmative spellings all mean idle", () => { for (const value of ["1", "true", "yes", "on", "TRUE", " On "]) { assert.equal(isIdleBoot({ [IDLE_BOOT_ENV]: value }), true, value); } }); test("empty and negative values arm the runners", () => { // A compose file writing an unset variable produces "", and that must not // read as "idle" — it is the difference between auto-queue running and not. for (const value of ["", "0", "false", "no", "off", " ", "maybe"]) { assert.equal(isIdleBoot({ [IDLE_BOOT_ENV]: value }), false, JSON.stringify(value)); } }); test("only this one variable is consulted", () => { assert.equal(isIdleBoot({ IDLE_BOOT: "1", ARCHILYZER_IDLE: "1" }), false); });