mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-09 22:33:37 +00:00
Server changes:
- Add /boards/runs to demo routes (delegates to list_runs)
- Fix demo get_run_status to return StoreRunSummary shape matching OpenAPI spec
- Enrich real /boards/runs to return RunListItem shape with board column mapping
(Running->working, Paused->pending, Completed->merge; others excluded)
- Update existing tests that asserted old RunStatusResponse fields from /boards/runs
Web UI changes:
- Add DemoModeProvider context and useDemoMode hook
- Hide Workflows/Insights nav items in production mode via getVisibleNavigation
- Change run-detail loader to use /runs/{id} directly instead of searching /boards/runs
- Add mapRunSummaryToRunItem for mapping server response to UI shape
- Add Graph tab, hide Stages tab in production mode, always hide Files tab
- Make run-overview and run-graph loaders resilient to 501 via apiJsonOrNull
- Add isNotImplemented and apiJsonOrNull helpers to api.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
826 B
TypeScript
29 lines
826 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { renderToString } from "react-dom/server";
|
|
import { DemoModeProvider, useDemoMode } from "./demo-mode";
|
|
|
|
function TestConsumer() {
|
|
const demoMode = useDemoMode();
|
|
return <span data-demo={demoMode}>{demoMode ? "demo" : "prod"}</span>;
|
|
}
|
|
|
|
describe("DemoModeProvider", () => {
|
|
test("provides demo mode value to children", () => {
|
|
const html = renderToString(
|
|
<DemoModeProvider value={true}>
|
|
<TestConsumer />
|
|
</DemoModeProvider>,
|
|
);
|
|
expect(html).toContain("demo");
|
|
expect(html).toContain('data-demo="true"');
|
|
});
|
|
|
|
test("defaults to false", () => {
|
|
const html = renderToString(
|
|
<DemoModeProvider value={false}>
|
|
<TestConsumer />
|
|
</DemoModeProvider>,
|
|
);
|
|
expect(html).toContain("prod");
|
|
});
|
|
});
|