mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(ui): keep plugin identity coverage focused
This commit is contained in:
@@ -260,6 +260,8 @@ describe("PluginsPage", () => {
|
||||
await waitForFast(() =>
|
||||
expect(request.mock.calls.filter(([method]) => method === "plugins.install")).toHaveLength(2),
|
||||
);
|
||||
await page.install("clawhub:@openclaw/lobster", installRequest);
|
||||
expect(request.mock.calls.filter(([method]) => method === "plugins.install")).toHaveLength(2);
|
||||
expect(page.messages[rowKey]?.installPolicyWarning).toBeDefined();
|
||||
page.messages["plugin:workboard"] = { kind: "success", text: "Unrelated message." };
|
||||
|
||||
@@ -369,50 +371,6 @@ describe("PluginsPage", () => {
|
||||
expect(page.result?.plugins[0]?.installed).toBe(false);
|
||||
});
|
||||
|
||||
it("deduplicates an active install across catalog and ClawHub search rows", async () => {
|
||||
const pendingInstall = deferred<PluginMutationResult>();
|
||||
const { client, request } = createClient(async (method) => {
|
||||
if (method === "plugins.install") {
|
||||
return pendingInstall.promise;
|
||||
}
|
||||
if (method === "plugins.list") {
|
||||
return createResult(
|
||||
createPlugin({ id: "lobster", name: "Lobster", installed: true, enabled: true }),
|
||||
);
|
||||
}
|
||||
throw new Error(`Unexpected method ${method}`);
|
||||
});
|
||||
const harness = createGateway(client);
|
||||
const catalog = createResult(
|
||||
createPlugin({
|
||||
id: "lobster",
|
||||
name: "Lobster",
|
||||
installed: false,
|
||||
install: { source: "clawhub", packageName: "@openclaw/lobster" },
|
||||
}),
|
||||
);
|
||||
const { page } = await mountPage(
|
||||
createContext(harness.gateway),
|
||||
createPluginsRouteData(harness.gateway, catalog),
|
||||
);
|
||||
const installRequest = {
|
||||
source: "clawhub",
|
||||
packageName: "@openclaw/lobster",
|
||||
} satisfies PluginInstallRequest;
|
||||
|
||||
const catalogInstall = page.install("plugin:lobster", installRequest);
|
||||
await waitForFast(() => expect(request).toHaveBeenCalledOnce());
|
||||
await page.install("clawhub:@openclaw/lobster", installRequest);
|
||||
expect(request).toHaveBeenCalledOnce();
|
||||
|
||||
pendingInstall.resolve({
|
||||
ok: true,
|
||||
plugin: createPlugin({ id: "lobster", name: "Lobster", installed: true, enabled: true }),
|
||||
restartRequired: true,
|
||||
});
|
||||
await catalogInstall;
|
||||
});
|
||||
|
||||
it("debounces two-character ClawHub searches and cancels stale input", async () => {
|
||||
vi.useFakeTimers();
|
||||
const { client, request } = createClient(async (method) => {
|
||||
|
||||
@@ -780,7 +780,7 @@ function renderPluginRow(
|
||||
): TemplateResult {
|
||||
const key = pluginRowKey(plugin.id);
|
||||
const installOperation = installOperationState(props, plugin.install);
|
||||
const busy = Boolean(props.busy[key] || installOperation.busy);
|
||||
const busy = props.busy[key] || installOperation.busy;
|
||||
return html`
|
||||
<article
|
||||
class="settings-row plugins-item plugins-item--clickable"
|
||||
@@ -1048,7 +1048,7 @@ function renderClawHubResult(item: PluginSearchResult, props: PluginsViewProps):
|
||||
const key = clawHubRowKey(pkg.name);
|
||||
const installRequest = { source: "clawhub", packageName: pkg.name } as const;
|
||||
const installOperation = installOperationState(props, installRequest, pkg.runtimeId);
|
||||
const busy = Boolean(props.busy[key] || installOperation.busy);
|
||||
const busy = props.busy[key] || installOperation.busy;
|
||||
const artSlug = pkg.runtimeId ?? pkg.name;
|
||||
return html`
|
||||
<article
|
||||
@@ -1219,7 +1219,7 @@ function renderDetailOverlay(props: PluginsViewProps) {
|
||||
}
|
||||
const key = pluginRowKey(plugin.id);
|
||||
const installOperation = installOperationState(props, plugin.install);
|
||||
const busy = Boolean(props.busy[key] || installOperation.busy);
|
||||
const busy = props.busy[key] || installOperation.busy;
|
||||
return html`
|
||||
<openclaw-modal-dialog
|
||||
label=${plugin.name}
|
||||
|
||||
Reference in New Issue
Block a user