Files
liqa/server/test/manifest.spec.ts
T
agent 1830feb71b refactor(auth): address server review feedback
- Extract auth DTOs, cookie/JWT helpers and the generic duration parser.
- Configure the session cookie and map domain auth failures to HTTP responses.
- Add typed Swagger responses and focused regression coverage.
2026-11-04 17:15:00 -05:00

55 lines
1.8 KiB
TypeScript

import { INestApplication } from "@nestjs/common";
import request from "supertest";
import { appPackage } from "../src/common/app-package";
import { ManifestDto } from "../src/manifest/manifest.dto";
import { buildTestApp } from "./app.harness";
describe("GET /manifest.json", () => {
it("describes the manifest auth flag without describing authentication as optional", () => {
const authProperty = Reflect.getMetadata(
"swagger/apiModelProperties",
ManifestDto.prototype,
"auth",
) as { description: string };
expect(authProperty.description).toBe(
"Whether account authentication is enabled.",
);
expect(authProperty.description).not.toContain("optional");
});
let app: INestApplication;
afterEach(async () => {
delete process.env.RUN_LOG_DATA_COLLAPSE_BYTES;
delete process.env.RUN_LOG_DATA_COLLAPSE_LINES;
await app?.close();
});
it("returns the app version and default run log data limits", async () => {
app = await buildTestApp();
const res = await request(app.getHttpServer())
.get("/manifest.json")
.expect(200);
expect(res.body).toEqual({
name: appPackage().name,
version: appPackage().version,
auth: { enabled: false },
runLogs: { dataLimits: { bytes: 256, lines: 5 } },
});
expect(res.headers["cache-control"]).toBe("no-cache");
expect(res.headers["etag"]).toBeDefined();
});
it("takes the run log data limits from the configuration", async () => {
process.env.RUN_LOG_DATA_COLLAPSE_BYTES = "1024";
process.env.RUN_LOG_DATA_COLLAPSE_LINES = "20";
app = await buildTestApp();
const res = await request(app.getHttpServer())
.get("/manifest.json")
.expect(200);
expect(res.body.runLogs.dataLimits).toEqual({ bytes: 1024, lines: 20 });
});
});