57 lines
2.0 KiB
JavaScript
57 lines
2.0 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import test from "node:test";
|
|
|
|
test("Quick Pane polls snapshots, renders answers, and gates handoff", async () => {
|
|
const source = await readFile(
|
|
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
|
|
"utf8",
|
|
);
|
|
assert.match(source, /get_session_runtime_snapshot/);
|
|
assert.match(source, /setInterval\(\(\) => void refresh\(\), 800\)/);
|
|
assert.match(
|
|
source,
|
|
/<pre style=\{\{ whiteSpace: "pre-wrap" \}\}>\{answer\}<\/pre>/,
|
|
);
|
|
assert.match(
|
|
source,
|
|
/\{\(escalation \|\| error\) && \(\s*<button onClick=\{continueFull\}>Continue in full session<\/button>\s*\)\}/,
|
|
);
|
|
});
|
|
|
|
test("main Settings owns Quick Pane configuration while pane keeps request controls", async () => {
|
|
const [pane, app, persistence] = await Promise.all([
|
|
readFile(
|
|
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
|
|
"utf8",
|
|
),
|
|
readFile(new URL("../ui/src/App.tsx", import.meta.url), "utf8"),
|
|
readFile(
|
|
new URL("../ui/src/workspace/persistence.ts", import.meta.url),
|
|
"utf8",
|
|
),
|
|
]);
|
|
assert.match(app, /load_ui_state/);
|
|
assert.match(app, /save_ui_state/);
|
|
assert.match(app, /Save Quick Pane settings/);
|
|
assert.match(pane, /get_model_catalog/);
|
|
assert.match(pane, /set_thinking_level/);
|
|
assert.doesNotMatch(pane, /showSettings/);
|
|
assert.doesNotMatch(pane, /Save Quick Pane settings/);
|
|
assert.doesNotMatch(pane, /setRequest\(""\)/);
|
|
assert.match(persistence, /quickPane: current\.quickPane/);
|
|
});
|
|
|
|
test("Quick Pane routes extension responses through existing bridge command", async () => {
|
|
const source = await readFile(
|
|
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
|
|
"utf8",
|
|
);
|
|
assert.match(
|
|
source,
|
|
/<ExtensionDialog extension=\{extension\} onRespond=\{respond\} \/>/,
|
|
);
|
|
assert.match(source, /invoke\("respond_to_extension"/);
|
|
assert.match(source, /requestId: extension\.id/);
|
|
});
|