mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
ci: deploy demo automatically
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { matchDemoRoute } from "../../../apps/demo/src/mock-api.js";
|
||||
|
||||
const packageJson = JSON.parse(
|
||||
readFileSync(path.resolve(process.cwd(), "package.json"), "utf8"),
|
||||
) as { version: string };
|
||||
|
||||
async function readJson(response: Response): Promise<unknown> {
|
||||
return response.json();
|
||||
}
|
||||
|
||||
describe("demo mock API", () => {
|
||||
it("reports the same app version as the current package build", async () => {
|
||||
const response = matchDemoRoute("/api/v1/health", "GET");
|
||||
|
||||
expect(response?.status).toBe(200);
|
||||
await expect(readJson(response as Response)).resolves.toMatchObject({
|
||||
status: "ok",
|
||||
version: packageJson.version,
|
||||
});
|
||||
});
|
||||
|
||||
it("returns the full auth configuration shape consumed by the real web app", async () => {
|
||||
const response = matchDemoRoute("/api/v1/config/auth", "GET");
|
||||
|
||||
expect(response?.status).toBe(200);
|
||||
await expect(readJson(response as Response)).resolves.toEqual({
|
||||
authEnabled: true,
|
||||
oidcEnabled: false,
|
||||
oidcProviderName: null,
|
||||
samlEnabled: false,
|
||||
samlProviderName: null,
|
||||
ssoEnforced: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user