fix(plugins): refresh workbench tabs after install and rollback
This commit is contained in:
6 files changed
+159
-5
No files matched your search
@@ -34,6 +34,7 @@ describe("useTauriEvents", () => {
|
||||
openDbFilePath: vi.fn(),
|
||||
openConnectionDeepLink: vi.fn(),
|
||||
closeActiveSurface,
|
||||
refreshPluginWorkbenches: vi.fn(),
|
||||
});
|
||||
|
||||
events.setupTauriListeners();
|
||||
@@ -44,4 +45,23 @@ describe("useTauriEvents", () => {
|
||||
events.cleanupTauriListeners();
|
||||
expect(unlisten).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("forwards replaced plugin runtimes to the workbench refresh hook", async () => {
|
||||
const refreshPluginWorkbenches = vi.fn();
|
||||
const events = useTauriEvents({
|
||||
openTableTarget: vi.fn(),
|
||||
openSqlFilePath: vi.fn(),
|
||||
openDbFilePath: vi.fn(),
|
||||
openConnectionDeepLink: vi.fn(),
|
||||
closeActiveSurface: vi.fn(),
|
||||
refreshPluginWorkbenches,
|
||||
});
|
||||
|
||||
events.setupTauriListeners();
|
||||
await vi.waitFor(() => expect(listeners.has("plugin-runtime-replaced")).toBe(true));
|
||||
listeners.get("plugin-runtime-replaced")!({ payload: { pluginId: "io.example.plugin", version: "0.2.0" } });
|
||||
|
||||
expect(refreshPluginWorkbenches).toHaveBeenCalledExactlyOnceWith("io.example.plugin");
|
||||
events.cleanupTauriListeners();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user