fix: close marketplace client review findings
This commit is contained in:
1 parent
8dfa542860
commit
1614f7efc1
25 files changed
+1224
-143
No files matched your search
@@ -68,7 +68,7 @@ describe('My Plugins', () => {
|
||||
const library: MarketplaceLibrarySnapshot = {
|
||||
total: 4, stale: false, fetchedAt: 1,
|
||||
items: [
|
||||
{ pluginId: 'makelore.notes', title: '灵感笔记', summary: 'Notes', category: '效率', acquisition: 'free', acquisitionMode: 'user_acquired', catalogStatus: 'active', runtimeStatus: 'enabled', acquiredAt: '2026-08-28T00:00:00Z', removedAt: null, stableVersion: '2.0.0', betaVersion: null },
|
||||
{ pluginId: 'makelore.notes', title: '灵感笔记', summary: 'Notes', category: '效率', acquisition: 'free', acquisitionMode: 'user_acquired', catalogStatus: 'active', runtimeStatus: 'enabled', acquiredAt: '2026-08-28T00:00:00Z', removedAt: null, stableVersion: '2.0.0', betaVersion: '2.1.0-beta.1' },
|
||||
{ pluginId: 'makelore.removed', title: '旧插件', summary: 'Removed', category: '效率', acquisition: 'free', acquisitionMode: 'user_acquired', catalogStatus: 'active', runtimeStatus: 'enabled', acquiredAt: '2026-08-27T00:00:00Z', removedAt: '2026-08-28T00:00:00Z', stableVersion: '1.0.0', betaVersion: null },
|
||||
{ pluginId: 'makelore.retired', title: '已退役插件', summary: 'Retired', category: '效率', acquisition: 'free', acquisitionMode: 'user_acquired', catalogStatus: 'retired', runtimeStatus: 'enabled', acquiredAt: '2026-08-26T00:00:00Z', removedAt: '2026-08-28T00:00:00Z', stableVersion: '1.0.0', betaVersion: null },
|
||||
{ pluginId: 'makelore.system', title: '开发数据服务', summary: 'Data', category: '系统', acquisition: 'system_included', acquisitionMode: 'system_included', catalogStatus: 'active', runtimeStatus: 'suspended', acquiredAt: null, removedAt: null, stableVersion: '1.0.0', betaVersion: null },
|
||||
@@ -82,7 +82,7 @@ describe('My Plugins', () => {
|
||||
render(<MemoryRouter><MyPluginsView
|
||||
library={library} installations={{ 'makelore.notes': { status: 'installed', pluginId: 'makelore.notes', version: '1.5.0', releaseId: 'release-1' } }}
|
||||
state="ready" pending={{}} onRefresh={vi.fn()} onInstall={vi.fn()} onUpdate={onUpdate}
|
||||
onUninstall={vi.fn()} onRemove={onRemove} onReacquire={onReacquire}
|
||||
onInstallBeta={vi.fn()} onUninstall={vi.fn()} onRemove={onRemove} onReacquire={onReacquire}
|
||||
/></MemoryRouter>);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '更新灵感笔记' }));
|
||||
@@ -98,15 +98,29 @@ describe('My Plugins', () => {
|
||||
expect(screen.getByText('已退役,移除后不可重新获取')).toBeVisible();
|
||||
});
|
||||
|
||||
it('offers an explicit Beta action without conflating it with stable updates', () => {
|
||||
const onInstallBeta = vi.fn();
|
||||
render(<MemoryRouter><MyPluginsView
|
||||
library={{ ...library, items: [library.items[0]] }}
|
||||
installations={{ 'makelore.notes': { status: 'installed', pluginId: 'makelore.notes', version: '2.0.0', releaseId: 'stable-2' } }}
|
||||
state="ready" pending={{}} onRefresh={vi.fn()} onInstall={vi.fn()} onUpdate={vi.fn()}
|
||||
onInstallBeta={onInstallBeta} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
/></MemoryRouter>);
|
||||
const beta = screen.getByRole('button', { name: '安装 Beta灵感笔记' });
|
||||
fireEvent.click(beta);
|
||||
expect(onInstallBeta).toHaveBeenCalledWith('makelore.notes');
|
||||
expect(screen.getByText('稳定版 2.0.0')).toBeVisible();
|
||||
});
|
||||
|
||||
it('names signature, yanked/not-ready, and incompatible failures without hiding the old install', () => {
|
||||
render(<MemoryRouter><MyPluginsView
|
||||
library={{ ...library, items: [library.items[0]] }}
|
||||
installations={{ 'makelore.notes': { status: 'unavailable', pluginId: 'makelore.notes', version: '1.5.0', reason: 'plugin_signature_invalid plugin_release_yanked plugin_incompatible_client' } }}
|
||||
state="ready" pending={{}} onRefresh={vi.fn()} onInstall={vi.fn()} onUpdate={vi.fn()}
|
||||
onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
onInstallBeta={vi.fn()} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
/></MemoryRouter>);
|
||||
expect(screen.getByText(/签名校验失败/)).toBeVisible();
|
||||
expect(screen.getByText(/版本已撤回或未就绪/)).toBeVisible();
|
||||
expect(screen.getByText(/此版本已撤回/)).toBeVisible();
|
||||
expect(screen.getByText(/当前 MakeLore 版本不兼容/)).toBeVisible();
|
||||
expect(screen.getByText('设备版本 1.5.0')).toBeVisible();
|
||||
});
|
||||
@@ -115,14 +129,14 @@ describe('My Plugins', () => {
|
||||
const { rerender } = render(<MemoryRouter><MyPluginsView
|
||||
library={{ ...library, items: [library.items[0]] }} installations={{}} state="ready"
|
||||
error="plugin_artifact_invalid: Plugin artifact is invalid" pending={{}} onRefresh={vi.fn()}
|
||||
onInstall={vi.fn()} onUpdate={vi.fn()} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
onInstall={vi.fn()} onUpdate={vi.fn()} onInstallBeta={vi.fn()} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
/></MemoryRouter>);
|
||||
expect(screen.getByRole('alert')).toHaveTextContent('签名或包校验失败');
|
||||
rerender(<MemoryRouter><MyPluginsView
|
||||
library={{ ...library, items: [library.items[0]] }} installations={{}} state="ready"
|
||||
error="plugin_release_not_ready: Plugin Release is not ready" pending={{}} onRefresh={vi.fn()}
|
||||
onInstall={vi.fn()} onUpdate={vi.fn()} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
onInstall={vi.fn()} onUpdate={vi.fn()} onInstallBeta={vi.fn()} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
|
||||
/></MemoryRouter>);
|
||||
expect(screen.getByRole('alert')).toHaveTextContent('已撤回、尚未就绪或与当前 MakeLore 不兼容');
|
||||
expect(screen.getByRole('alert')).toHaveTextContent('版本尚未就绪;不会替换此前可用版本');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user