e4dcfc49aa
Tests / Lint and Format (push) Waiting to run
Tests / Web Node Tests (push) Waiting to run
Tests / Import Check (Python 3.11) (push) Waiting to run
Tests / Import Check (Python 3.12) (push) Waiting to run
Tests / Import Check (Python 3.13) (push) Waiting to run
Tests / Import Check (Python 3.14) (push) Waiting to run
Tests / Python Tests (Python 3.11) (push) Blocked by required conditions
Tests / Python Tests (Python 3.12) (push) Blocked by required conditions
Tests / Python Tests (Python 3.13) (push) Blocked by required conditions
Tests / Python Tests (Python 3.14) (push) Blocked by required conditions
Tests / Test Summary (push) Blocked by required conditions
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { parseAuthEnabled } from "../lib/api";
|
|
|
|
test("parseAuthEnabled is true for accepted truthy flags", () => {
|
|
for (const value of ["true", "1", "yes", "on", "TRUE", " true "]) {
|
|
assert.equal(
|
|
parseAuthEnabled(value),
|
|
true,
|
|
`expected ${JSON.stringify(value)} -> true`,
|
|
);
|
|
}
|
|
});
|
|
|
|
test("parseAuthEnabled is false for falsy / empty / undefined", () => {
|
|
for (const value of ["false", "0", "no", "off", "", undefined]) {
|
|
assert.equal(
|
|
parseAuthEnabled(value),
|
|
false,
|
|
`expected ${JSON.stringify(value)} -> false`,
|
|
);
|
|
}
|
|
});
|
|
|
|
// Guards the failure mode this flag was hardened against: if the Docker
|
|
// placeholder is ever served unsubstituted, it must read as "disabled" rather
|
|
// than throwing or accidentally enabling auth.
|
|
test("parseAuthEnabled treats an unsubstituted Docker placeholder as disabled", () => {
|
|
assert.equal(
|
|
parseAuthEnabled("__NEXT_PUBLIC_AUTH_ENABLED_PLACEHOLDER__"),
|
|
false,
|
|
);
|
|
});
|