Install child-friendly replies by default through signed Marketplace delivery

This commit is contained in:
brother7 committed 2026-09-28 23:00:54 +08:00
1 parent efff238a75
commit e70b6eab91
8 files changed
+276 -18

No files matched your search

+16 -9
View File
@@ -18,16 +18,18 @@ test.describe('Unified plugin workspace', () => {
stableVersion: '1.0.0', betaVersion: null,
};
const result = (json: unknown) => ({ ok: true, data: { status: 200, ok: true, json } });
const defaultItem = { ...item, pluginId: 'makelore.child-friendly-replies', title: '对孩子说清楚' };
const entry = (value: typeof item) => ({
pluginId: value.pluginId, title: value.title, summary: value.summary, category: value.category,
acquisition: 'free', acquisitionMode: 'user_acquired', catalogStatus: 'active', runtimeStatus: 'enabled',
acquiredAt: '2026-09-28T00:00:00Z', removedAt: null, stableVersion: '1.0.0', betaVersion: null,
});
const library = () => ({
library: {
items: acquired ? [{
pluginId: item.pluginId, title: item.title, summary: item.summary, category: item.category,
acquisition: 'free', acquisitionMode: 'user_acquired', catalogStatus: 'active', runtimeStatus: 'enabled',
acquiredAt: '2026-09-03T00:00:00Z', removedAt: null, stableVersion: '1.0.0', betaVersion: null,
}] : [],
total: acquired ? 1 : 0, stale: false, fetchedAt: 1,
items: [entry(defaultItem), ...(acquired ? [entry(item)] : [])],
total: acquired ? 2 : 1, stale: false, fetchedAt: 1,
},
installations: [],
installations: [{ pluginId: defaultItem.pluginId, status: 'installed', releaseId: 'child-1', version: '1.0.0', channel: 'stable' }],
});
(globalThis as typeof globalThis & { __pluginsE2E?: { requests: string[] } }).__pluginsE2E = { requests };
ipcMain.removeHandler('hostapi:fetch');
@@ -59,7 +61,7 @@ test.describe('Unified plugin workspace', () => {
},
});
if (requestPath.startsWith('/api/coding/plugin-marketplace/catalog')) return result({
items: [item], nextCursor: null, total: 1, catalogGeneration: 1,
items: [item, defaultItem], nextCursor: null, total: 2, catalogGeneration: 1,
etag: 'plugins-1', pricingVersionId: null, stale: false, fetchedAt: 1,
});
if (requestPath === '/api/coding/plugin-marketplace/plugins/makelore.notes') return result({
@@ -93,10 +95,14 @@ test.describe('Unified plugin workspace', () => {
await expect(page.getByTestId('project-plugins-sheet')).toBeVisible();
await expect(page.getByTestId('plugins-page')).toBeVisible();
await expect(page).toHaveURL(/\/project-config\/plugins\?scope=all/);
await expect(page.getByText('为你的智能体添加插件,拓展更多能力。')).toBeVisible();
await expect(page.getByTestId('plugin-tabs')).toBeVisible();
await expect(page.getByRole('button', { name: /刷新/ })).toHaveCount(0);
await expect(page.getByRole('searchbox')).toHaveCount(0);
await expect(page.getByRole('combobox')).toHaveCount(0);
await page.getByTestId('plugin-tab-installed').click();
await expect(page.getByRole('heading', { name: '对孩子说清楚' })).toBeVisible();
await expect(page.getByRole('button', { name: '安装对孩子说清楚', exact: true })).toHaveCount(0);
await page.getByTestId('plugin-tab-available').click();
await expect(page.getByRole('button', { name: '添加灵感笔记' })).toBeVisible();
await page.getByRole('button', { name: '查看灵感笔记详情' }).click();
await expect(page.getByRole('dialog', { name: '灵感笔记' })).toContainText('详细介绍');
@@ -111,6 +117,7 @@ test.describe('Unified plugin workspace', () => {
(globalThis as typeof globalThis & { __pluginsE2E?: { requests: string[] } }).__pluginsE2E?.requests ?? []
));
expect(requests).toContain('PUT /api/coding/plugin-marketplace/library/makelore.notes');
expect(requests.some((request) => request.includes('/installations/makelore.child-friendly-replies'))).toBe(false);
expect(requests.some((request) => request.startsWith('PUT /api/coding/plugins/'))).toBe(false);
} finally {
await closeElectronApp(app);