fix(dev): proxy api during react development
This commit is contained in:
parent
b1d196e4ca
commit
b8e39348e8
11 changed files with 196 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { renderToString } from "react-dom/server";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { genericDashboardFixture } from "$lib/model/fixtures/generic";
|
||||
import { AppStateView } from "./App";
|
||||
import { AppStateView, resolveDocumentMetadata } from "./App";
|
||||
|
||||
describe("home page model renderer", () => {
|
||||
test("renders the active dashboard model from the runtime state", () => {
|
||||
|
|
@ -43,6 +43,30 @@ describe("home page model renderer", () => {
|
|||
expect(body).toContain("/metadata/title is required");
|
||||
});
|
||||
|
||||
test("derives browser metadata from ready and fallback runtime states", () => {
|
||||
const ready = resolveDocumentMetadata({
|
||||
state: "ready",
|
||||
document: genericDashboardFixture,
|
||||
schemaVersion: "dashboard.v1",
|
||||
currentRevisionId: "revision-1234567890",
|
||||
});
|
||||
const empty = resolveDocumentMetadata({
|
||||
state: "empty",
|
||||
title: "No Dashboard Model",
|
||||
subtitle: "No active document",
|
||||
message: "No validated dashboard document is active yet.",
|
||||
});
|
||||
|
||||
expect(ready).toEqual({
|
||||
title: "Operations Console",
|
||||
description: "Generic environment",
|
||||
});
|
||||
expect(empty).toEqual({
|
||||
title: "No Dashboard Model",
|
||||
description: "No active document",
|
||||
});
|
||||
});
|
||||
|
||||
test("renders empty and loading model states without crashing", () => {
|
||||
const empty = renderToString(
|
||||
<AppStateView
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue