Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

test(desktop): align HTML file ref routing coverage

vastsa9455ce1178dd
diff --git a/apps/desktop/test/tool-row-file-refs.test.mjs b/apps/desktop/test/tool-row-file-refs.test.mjs
index a300fa4f8..91f65d760 100644
--- a/apps/desktop/test/tool-row-file-refs.test.mjs
+++ b/apps/desktop/test/tool-row-file-refs.test.mjs
@@ -123,11 +123,12 @@ const { useOpenPreviewTarget } = loadModule("../src/hooks/use-preview-target.ts"
const flush = () => new Promise((resolve) => setImmediate(resolve));
-function reset({ pluginView = false } = {}) {
+function reset({ pluginView = false, browserPluginView = false } = {}) {
Object.values(calls).forEach((list) => list.splice(0, list.length));
- state.pluginViews = pluginView
- ? [{ pluginId: "pi.file-manager", viewId: "manager" }]
- : [];
+ state.pluginViews = [
+ ...(pluginView ? [{ pluginId: "pi.file-manager", viewId: "manager" }] : []),
+ ...(browserPluginView ? [{ pluginId: "pi.browser", viewId: "browser" }] : []),
+ ];
nextMatch = null;
nextReason = null;
resolveFails = false;
@@ -322,11 +323,20 @@ test("a file from a sibling project folder opens in the view by absolute path",
});
test("a primary-folder HTML page stays with the side browser", async () => {
- reset({ pluginView: true });
+ reset({ pluginView: true, browserPluginView: true });
nextMatch = projectMatch({ relativePath: "docs/page.html", absolutePath: "C:/project/docs/page.html" });
await click({ kind: "file", path: "docs/page.html" });
assert.deepEqual(calls.tabs, [], "a page to run is not a file to read");
- assert.deepEqual(calls.urls, [["docs/page.html"]]);
+ assert.deepEqual(calls.urls, [["C:/project/docs/page.html"]]);
+});
+
+test("an HTML reference reports a disabled Browser view without enabling it", async () => {
+ reset({ pluginView: true });
+ nextMatch = projectMatch({ relativePath: "docs/page.html", absolutePath: "C:/project/docs/page.html" });
+ await click({ kind: "file", path: "docs/page.html" });
+ assert.deepEqual(calls.urls, []);
+ assert.deepEqual(calls.enabled, []);
+ assert.deepEqual(calls.toasts[0], ["panel.pluginView.failed:", { variant: "error" }]);
});
test("a reference nothing answers reports itself and opens nothing", async () => {