fix(confidence-engine): preserve scenario during outage
This commit is contained in:
@@ -14,7 +14,9 @@ import ReasoningWorkspace, {
|
||||
} from "@/components/reasoning-workspace.jsx";
|
||||
import {
|
||||
ScenarioResultPanels,
|
||||
UnavailableStartPanel,
|
||||
UpdateErrorPanel,
|
||||
isUnavailableStartResponse,
|
||||
submitAnswerForUpdateCase,
|
||||
submitScenarioForStartCase,
|
||||
} from "@/components/scenario-form.jsx";
|
||||
@@ -372,6 +374,26 @@ function makeCommercialUpdateSuccess(overrides = {}) {
|
||||
}
|
||||
|
||||
describe("scenario-form UI helpers", () => {
|
||||
it("recognises only the established sanitized unavailable start response", () => {
|
||||
expect(isUnavailableStartResponse(
|
||||
{ status: 503 },
|
||||
{ success: false, error: "Reasoning service is temporarily unavailable." },
|
||||
)).toBe(true);
|
||||
expect(isUnavailableStartResponse(
|
||||
{ status: 500 },
|
||||
{ success: false, error: "Reasoning service is temporarily unavailable." },
|
||||
)).toBe(false);
|
||||
});
|
||||
|
||||
it("presents generic recovery without provider details", () => {
|
||||
const html = renderToStaticMarkup(<UnavailableStartPanel onRetry={vi.fn()} />);
|
||||
|
||||
expect(html).toContain("Confidence Engine is temporarily unavailable.");
|
||||
expect(html).toContain("Your scenario is still here and you can try again.");
|
||||
expect(html).toContain(">Retry<");
|
||||
expect(html).not.toMatch(/ollama|provider|local model|server|infrastructure/i);
|
||||
});
|
||||
|
||||
it("submits to /api/cases/start", async () => {
|
||||
const fetchImpl = vi.fn().mockResolvedValue({ ok: true });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user