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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user