fix: close marketplace client review findings
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user