Files
liqa/server/test/auth-disabled.spec.ts
T
agent de41571b5c feat(auth): add optional authentication boundary
- Add account, JWT session, revocation, cookie and bearer handling.
- Protect server surfaces while preserving public health, manifest and disabled mode.
- Add SQLite migration and focused server regression coverage.
2026-11-04 15:43:33 -05:00

35 lines
1.1 KiB
TypeScript

import { INestApplication } from "@nestjs/common";
import request from "supertest";
import { buildTestApp } from "./app.harness";
describe("authentication disabled", () => {
const envKeys = ["AUTH_ENABLED", "AUTH_JWT_SECRET"] as const;
const previousEnv = new Map<string, string | undefined>();
let app: INestApplication;
beforeAll(async () => {
for (const key of envKeys) previousEnv.set(key, process.env[key]);
process.env.AUTH_ENABLED = "false";
delete process.env.AUTH_JWT_SECRET;
app = await buildTestApp();
});
afterAll(async () => {
await app?.close();
for (const key of envKeys) {
const value = previousEnv.get(key);
if (value === undefined) delete process.env[key];
else process.env[key] = value;
}
});
it("starts without a secret and leaves existing REST behavior public", async () => {
await request(app.getHttpServer()).get("/scenarios").expect(200);
await request(app.getHttpServer()).get("/health").expect(200);
const manifest = await request(app.getHttpServer())
.get("/manifest.json")
.expect(200);
expect(manifest.body.auth).toEqual({ enabled: false });
});
});