Files
fusion/packages/dashboard/app/__tests__/ShellContext.test.tsx
Fusion 419c6f3b31 feat(FN-3400): add native shell connection handoff, plugin management CLI/l
This merge adds a complete plugin management system (FN-3565) with CLI commands, a loader, runner, and dashboard routes, along with project-scoped auth storage (FN-3544), native shell connection support for mobile (FN-3400) spanning onboarding, connection manager, and remote desktop handoff, and ref

Fusion-Task-Id: FN-3400
2026-05-06 05:29:56 -07:00

42 lines
1.3 KiB
TypeScript

import { render, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { ShellProvider, useShellContext } from "../context/ShellContext";
function Probe() {
const { openConnectionManagerSignal } = useShellContext();
return <div data-testid="signal">{openConnectionManagerSignal}</div>;
}
describe("ShellProvider", () => {
beforeEach(() => {
window.fusionShell = {
getState: vi.fn(async () => ({ host: "mobile-shell", activeProfileId: null, profiles: [] })),
listProfiles: vi.fn(async () => []),
saveProfile: vi.fn(),
deleteProfile: vi.fn(),
setActiveProfile: vi.fn(),
setDesktopMode: vi.fn(),
startQrScan: vi.fn(),
openConnectionManager: vi.fn(async () => {
window.dispatchEvent(new CustomEvent("shell:open-connection-manager"));
}),
subscribe: vi.fn(() => () => undefined),
} as never;
});
it("increments open-connection-manager signal when event fires", async () => {
const { getByTestId } = render(
<ShellProvider>
<Probe />
</ShellProvider>,
);
expect(getByTestId("signal").textContent).toBe("0");
window.dispatchEvent(new CustomEvent("shell:open-connection-manager"));
await waitFor(() => {
expect(getByTestId("signal").textContent).toBe("1");
});
});
});