fabro/apps/fabro-web/app/install-flow.test.ts
Bryan Helmkamp 9dd792c8b8
fix(install): exclude openai-compatible from v1 setup
Restrict the browser install flow to Anthropic, OpenAI, and Gemini,
remove the unused install-time base URL surface, and reject
openai_compatible with a stable 422 response.

Also fix the finishing health poller so it only redirects after the
server comes back healthy outside install mode instead of jumping early
on transient restart failures.
2026-04-19 11:43:38 -04:00

38 lines
966 B
TypeScript

import { describe, expect, test } from "bun:test";
import { shouldRedirectAfterHealthPoll } from "./install-flow";
describe("shouldRedirectAfterHealthPoll", () => {
test("waits when the health request fails", () => {
expect(shouldRedirectAfterHealthPoll({ kind: "error" })).toBe(false);
});
test("waits when the server returns a non-success status", () => {
expect(
shouldRedirectAfterHealthPoll({
kind: "response",
ok: false,
}),
).toBe(false);
});
test("waits while the server is still in install mode", () => {
expect(
shouldRedirectAfterHealthPoll({
kind: "response",
ok: true,
mode: "install",
}),
).toBe(false);
});
test("redirects only after the server returns success outside install mode", () => {
expect(
shouldRedirectAfterHealthPoll({
kind: "response",
ok: true,
mode: "normal",
}),
).toBe(true);
});
});