feat(FN-3409): add shell regression matrix for mobile, desktop, and dashboa

The merge completes a multi-step shell regression hardening effort spanning desktop, mobile, and dashboard entry points, adding 12 test files or test expansions to lock down the shell preload and native contracts. A companion fix exempts internal coordination tools (`list_agents`, `delegate_task`, e

Fusion-Task-Id: FN-3409
This commit is contained in:
Fusion
2026-05-08 01:53:58 -07:00
committed by gsxdsm
parent ae7a607972
commit 8e839fc950
11 changed files with 209 additions and 8 deletions

View File

@@ -70,9 +70,44 @@ describe("preload", () => {
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:openConnectionManager");
});
it("fusionShell subscribes and unsubscribes state listener", async () => {
it("fusionShell delegates connection-management methods to IPC", async () => {
await importPreloadModule();
const shell = getExposed<{ subscribe: (listener: (state: unknown) => void) => () => void }>("fusionShell");
const shell = getExposed<{
getState: () => Promise<unknown>;
listProfiles: () => Promise<unknown>;
saveProfile: (profile: { name: string; serverUrl: string; authToken?: string | null }) => Promise<unknown>;
deleteProfile: (profileId: string) => Promise<void>;
setActiveProfile: (profileId: string | null) => Promise<unknown>;
getDesktopModeState: () => Promise<unknown>;
setDesktopMode: (mode: "local" | "remote") => Promise<unknown>;
startQrScan: () => Promise<unknown>;
openConnectionManager: () => Promise<void>;
subscribe: (listener: (state: unknown) => void) => () => void;
}>("fusionShell");
await shell?.getState();
await shell?.listProfiles();
await shell?.saveProfile({ name: "Prod", serverUrl: "https://fusion.example.com", authToken: "token" });
await shell?.deleteProfile("p1");
await shell?.setActiveProfile("p1");
await shell?.getDesktopModeState();
await shell?.setDesktopMode("local");
await shell?.startQrScan();
await shell?.openConnectionManager();
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:getState");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:listProfiles");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:saveProfile", {
name: "Prod",
serverUrl: "https://fusion.example.com",
authToken: "token",
});
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:deleteProfile", "p1");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:setActiveProfile", "p1");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:getDesktopModeState");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:setDesktopMode", "local");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:startQrScan");
expect(mocks.ipcRenderer.invoke).toHaveBeenCalledWith("shell:openConnectionManager");
const unsubscribe = shell?.subscribe(() => undefined);
expect(mocks.ipcRenderer.on).toHaveBeenCalledWith("shell:state", expect.any(Function));