feat: add plugin marketplace renderer

This commit is contained in:
brother7 committed 2026-08-28 18:42:28 +08:00
1 parent 8b6824a8ba
commit 97c9ad1aad
27 files changed
+1585 -23

No files matched your search

+15 -2
View File
@@ -9,6 +9,7 @@ function projection(): CodingPluginProject {
schemaVersion: 1,
project: { localProjectId: 'local-only-id', durableProjectId: '11111111-1111-4111-8111-111111111111' },
policyStatus: 'current',
unknownPluginIds: [],
items: [{
id: 'makelore.data-service', version: '1.0.0', displayName: '开发数据服务', description: '为当前项目提供 JSON 数据。',
contractVersion: 1, requiresBackend: true,
@@ -60,7 +61,7 @@ describe('Project Plugin Center', () => {
expect(screen.getByText('计费策略暂不可用,相关调用已停用。')).toBeVisible();
expect(screen.queryByText('local-only-id')).not.toBeInTheDocument();
expect(screen.queryByText('11111111-1111-4111-8111-111111111111')).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '启用开发数据服务' }));
fireEvent.click(screen.getByRole('button', { name: '启用到项目开发数据服务' }));
expect(onSetEnabled).toHaveBeenCalledWith('makelore.data-service', true);
});
@@ -77,6 +78,18 @@ describe('Project Plugin Center', () => {
value.items[0].capabilities[0].operations[0].billing = { mode: 'platform_metered', availability: 'unavailable', notice: 'pricing unavailable' };
render(<MemoryRouter><ProjectPluginsView projectName="Demo" projection={value} dataService={null} pending={{}} agentNames={{}} onRefresh={vi.fn()} onSetEnabled={vi.fn()} onConfigure={vi.fn()} onReset={vi.fn()} onRemoveCollection={vi.fn()} onRemoveProject={vi.fn()} /></MemoryRouter>);
expect(screen.getByText('计费策略暂不可用,相关调用已停用。')).toBeVisible();
expect(screen.getByRole('button', { name: '启用开发数据服务' })).toBeDisabled();
expect(screen.getByRole('button', { name: '启用到项目开发数据服务' })).toBeDisabled();
});
it('shows retained unknown IDs without invented metadata and allows only explicit disable', () => {
const value = projection();
value.unknownPluginIds = ['makelore.removed'];
const onSetEnabled = vi.fn();
render(<MemoryRouter><ProjectPluginsView projectName="Demo" projection={value} dataService={null} pending={{}} agentNames={{}} onRefresh={vi.fn()} onSetEnabled={onSetEnabled} onConfigure={vi.fn()} onReset={vi.fn()} onRemoveCollection={vi.fn()} onRemoveProject={vi.fn()} /></MemoryRouter>);
expect(screen.getByText('配置保留、当前不可用')).toBeVisible();
expect(screen.getByText('makelore.removed')).toBeVisible();
expect(screen.queryByText(/makelore.removed.*v\d/u)).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '从项目禁用保留插件 makelore.removed' }));
expect(onSetEnabled).toHaveBeenCalledWith('makelore.removed', false);
});
});