feat(FN-2394): add Fusion reinstall flow for Pi extensions
- Add dashboard route and server handling to reinstall the Fusion Pi extension - Introduce a client API helper and wire a reinstall action into PiExtensionsManager - Polish action spacing and document Fusion reinstall recovery in the CLI README - Expand route, API, and component tests including reinstall refresh stability coverage - Add a changeset for @runfusion/fusion patch release
This commit is contained in:
@@ -55,6 +55,7 @@ import {
|
||||
fetchPiSettings,
|
||||
updatePiSettings,
|
||||
installPiPackage,
|
||||
reinstallFusionPiPackage,
|
||||
fetchPiExtensions,
|
||||
updatePiExtensions,
|
||||
fetchProjectTasks,
|
||||
@@ -5962,6 +5963,45 @@ describe("installPiPackage", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("reinstallFusionPiPackage", () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
|
||||
afterEach(() => {
|
||||
globalThis.fetch = originalFetch;
|
||||
});
|
||||
|
||||
it("sends POST to /api/pi-settings/reinstall-fusion", async () => {
|
||||
globalThis.fetch = vi.fn().mockReturnValue(
|
||||
mockFetchResponse(true, { success: true, source: "npm:@runfusion/fusion" })
|
||||
);
|
||||
|
||||
const result = await reinstallFusionPiPackage();
|
||||
|
||||
expect(result).toEqual({ success: true, source: "npm:@runfusion/fusion" });
|
||||
expect(globalThis.fetch).toHaveBeenCalledWith("/api/pi-settings/reinstall-fusion", expect.objectContaining({
|
||||
method: "POST",
|
||||
}));
|
||||
});
|
||||
|
||||
it("forwards projectId query parameter when provided", async () => {
|
||||
globalThis.fetch = vi.fn().mockReturnValue(
|
||||
mockFetchResponse(true, { success: true, source: "npm:@runfusion/fusion" })
|
||||
);
|
||||
|
||||
await reinstallFusionPiPackage("proj-123");
|
||||
|
||||
expect(globalThis.fetch).toHaveBeenCalledWith("/api/pi-settings/reinstall-fusion?projectId=proj-123", expect.objectContaining({
|
||||
method: "POST",
|
||||
}));
|
||||
});
|
||||
|
||||
it("throws API error message on failure", async () => {
|
||||
globalThis.fetch = vi.fn().mockReturnValue(mockFetchResponse(false, { error: "Reinstall failed" }, 500));
|
||||
|
||||
await expect(reinstallFusionPiPackage()).rejects.toThrow("Reinstall failed");
|
||||
});
|
||||
});
|
||||
|
||||
describe("fetchPiExtensions", () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user