import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const layoutSource = readFileSync(
new URL("./Layout.tsx", import.meta.url),
"utf8",
);
const railSource = readFileSync(
new URL("../workspace-app-host.tsx", import.meta.url),
"utf8",
);
describe("Dispatch layout scrolling", () => {
it("keeps page scrolling inside the viewport with a sticky chat control", () => {
expect(layoutSource).toMatch(/",
);
expect(layoutSource).toContain(" {
it("routes the open-app rail through the shared app-chat component", () => {
// Both app surfaces must share one rail: a second inlined AgentSidebar is
// how one of them silently keeps talking to Dispatch's own agent.
expect(layoutSource).toContain(" {
expect(railSource).toContain('openStorageKey="dispatch-app-chat"');
expect(railSource).toContain("storageKey={`dispatch-app-chat:${appId}`}");
expect(railSource).toContain("apiUrl={appChat.apiUrl}");
});
});