fix(plugins): load official hosted plugins from bundled resources

This commit is contained in:
brother7 committed 2026-09-01 18:32:22 +08:00
1 parent 52e2a97a12
commit 1530ac7740
23 files changed
+835 -48

No files matched your search

@@ -129,6 +129,29 @@ describe('My Plugins', () => {
expect(screen.getByRole('link', { name: '分配给伙伴' })).toBeVisible();
});
it('shows acquired code-owned bundled Plugins as supplied without device download actions', () => {
const bundled = {
...library.items[0],
pluginId: 'makelore.web-search',
title: '联网搜索',
stableVersion: '1.0.0',
betaVersion: null,
};
render(<MemoryRouter><MyPluginsView
library={{ ...library, items: [bundled] }} installations={{}} state="ready"
pending={{}} onRefresh={vi.fn()} onInstall={vi.fn()} onUpdate={vi.fn()}
onInstallBeta={vi.fn()} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
/></MemoryRouter>);
expect(screen.getByText('随 MakeLore 提供')).toBeVisible();
expect(screen.queryByText('尚未下载到设备')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: '下载联网搜索' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: '更新联网搜索' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: '删除设备上的联网搜索' })).not.toBeInTheDocument();
expect(screen.getByRole('button', { name: '移除联网搜索' })).toBeVisible();
expect(screen.getByRole('link', { name: '启用到项目' })).toBeVisible();
});
it('updates an installed Beta package only through the explicit Beta action', () => {
const onUpdate = vi.fn();
const onInstallBeta = vi.fn();