fix: close marketplace client review findings

This commit is contained in:
2026-08-28 21:01:51 +08:00
parent 8dfa542860
commit 1614f7efc1
25 changed files with 1224 additions and 143 deletions

View File

@@ -141,6 +141,32 @@ describe('host-api', () => {
);
});
it('preserves a bounded Marketplace status through browser fallback', async () => {
const fetchMock = vi.fn().mockResolvedValue({
ok: false,
status: 409,
statusText: 'Conflict',
json: async () => ({
success: false,
code: 'plugin_release_yanked',
error: 'Release is no longer available',
}),
});
vi.stubGlobal('fetch', fetchMock);
window.localStorage.setItem('niancode:allow-localhost-fallback', '1');
invokeIpcMock.mockResolvedValueOnce({
ok: false,
error: { message: 'No handler registered for hostapi:fetch' },
});
const { hostApiFetch } = await import('@/lib/host-api');
await expect(hostApiFetch('/api/coding/plugin-marketplace/install/notes'))
.rejects.toMatchObject({
message: 'Release is no longer available',
details: { backendCode: 'plugin_release_yanked', status: 409 },
});
});
it('throws message from legacy non-ok envelope', async () => {
invokeIpcMock.mockResolvedValueOnce({
success: true,