fix: complete marketplace client remediation

This commit is contained in:
brother7 committed 2026-08-28 23:16:24 +08:00
1 parent 2c3baf6dff
commit 11d0af0166
18 files changed
+1007 -90

No files matched your search

@@ -112,6 +112,35 @@ describe('My Plugins', () => {
expect(screen.getByText('稳定版 2.0.0')).toBeVisible();
});
it('updates an installed Beta package only through the explicit Beta action', () => {
const onUpdate = vi.fn();
const onInstallBeta = vi.fn();
render(<MemoryRouter><MyPluginsView
library={{ ...library, items: [library.items[0]] }}
installations={{ 'makelore.notes': { status: 'installed', pluginId: 'makelore.notes', channel: 'beta', version: '2.0.0', releaseId: 'beta-1' } }}
state="ready" pending={{}} onRefresh={vi.fn()} onInstall={vi.fn()} onUpdate={onUpdate}
onInstallBeta={onInstallBeta} onUninstall={vi.fn()} onRemove={vi.fn()} onReacquire={vi.fn()}
/></MemoryRouter>);
expect(screen.queryByRole('button', { name: '更新灵感笔记' })).not.toBeInTheDocument();
const updateBeta = screen.getByRole('button', { name: '更新 Beta灵感笔记' });
fireEvent.click(updateBeta);
expect(onInstallBeta).toHaveBeenCalledWith('makelore.notes');
expect(onUpdate).not.toHaveBeenCalled();
expect(screen.getByText('当前频道:Beta')).toBeVisible();
});
it('does not silently fall back to stable when the installed Beta channel has no release', () => {
render(<MemoryRouter><MyPluginsView
library={{ ...library, items: [{ ...library.items[0], betaVersion: null }] }}
installations={{ 'makelore.notes': { status: 'installed', pluginId: 'makelore.notes', channel: 'beta', version: '2.0.0', releaseId: 'beta-1' } }}
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('当前 Beta 频道暂无可用版本;不会静默切回稳定版。')).toBeVisible();
expect(screen.queryByRole('button', { name: '更新灵感笔记' })).not.toBeInTheDocument();
});
it('names signature, yanked/not-ready, and incompatible failures without hiding the old install', () => {
render(<MemoryRouter><MyPluginsView
library={{ ...library, items: [library.items[0]] }}