Skip to content

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

test(skills): scope file import contract to the file picker

Jack84831e48077f
diff --git a/apps/desktop/test/extensions-page.test.mjs b/apps/desktop/test/extensions-page.test.mjs
index 483413ddf..de8596d8c 100644
--- a/apps/desktop/test/extensions-page.test.mjs
+++ b/apps/desktop/test/extensions-page.test.mjs
@@ -164,13 +164,13 @@ test("capability sections flow at natural height with skeleton loading", () => {
});
test("skill import is one native file and physically targets the selected level", () => {
- const start = electronMainSrc.indexOf("handle(IPC.invoke.skillImport");
- const end = electronMainSrc.indexOf("handle(\n IPC.invoke.skillUpdate", start);
- const handler = electronMainSrc.slice(start, end);
- assert.ok(start >= 0 && end > start, "skill import handler is missing");
+ const handler = electronMainSrc.match(
+ /handle\(\s*IPC\.invoke\.skillImport[\s\S]*?(?=handle\(\s*IPC\.invoke\.skillUpdate)/,
+ )?.[0];
+ assert.ok(handler, "skill import handler is missing");
assert.match(handler, /properties: \["openFile"\]/);
- assert.doesNotMatch(handler, /\bmultiple\b/);
- assert.match(handler, /host\.call\("skills\.import"/);
+ assert.match(handler, /path: picked\.filePaths\[0\]/);
+ assert.match(handler, /currentHost\.call\("skills\.import"/);
assert.match(settingsComponents.get("AgentSkillsPage.tsx"), /api\.importUserSkill\(/);
assert.match(hostCapabilitySources, /fs::copy\(source, target\)/);
});