fix(design): preserve command outcome certainty
This commit is contained in:
@@ -54,6 +54,32 @@ describe('host-api', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves command outcome certainty from the Host API error envelope', async () => {
|
||||
invokeIpcMock.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
data: {
|
||||
status: 502,
|
||||
ok: false,
|
||||
json: {
|
||||
success: false,
|
||||
code: 'design_reasoner_invalid',
|
||||
error: 'AI 没有整理好这次想法,请再试一次',
|
||||
commandOutcome: 'definitive_failure',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const { hostApiFetch } = await import('@/lib/host-api');
|
||||
|
||||
await expect(hostApiFetch('/api/works/image-workspace/workspaces/workspace-1/commands'))
|
||||
.rejects.toMatchObject({
|
||||
details: expect.objectContaining({
|
||||
backendCode: 'design_reasoner_invalid',
|
||||
commandOutcome: 'definitive_failure',
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns undefined for a unified 204 response', async () => {
|
||||
invokeIpcMock.mockResolvedValueOnce({
|
||||
ok: true,
|
||||
|
||||
Reference in New Issue
Block a user