fix: macro tab MSW mock returns wrong response shape
The handler for /api/macro/impacts/:ticker was returning the impacts
array directly instead of { exposure_profile, impacts }. The frontend
destructures macroData.impacts which was undefined, falling back to
an empty array — so the Macro tab always showed 'No active macro impacts'
even with mock data present.
This commit is contained in:
@@ -163,7 +163,7 @@ export const handlers = [
|
|||||||
const ev = mockMacroEvents.find((e) => e.id === params.id);
|
const ev = mockMacroEvents.find((e) => e.id === params.id);
|
||||||
return ev ? HttpResponse.json({ ...ev, model_provider: 'ollama', model_name: 'test-model', prompt_version: 'event-v1', schema_version: '1.0.0', impacts: mockMacroImpacts }) : new HttpResponse(null, { status: 404 });
|
return ev ? HttpResponse.json({ ...ev, model_provider: 'ollama', model_name: 'test-model', prompt_version: 'event-v1', schema_version: '1.0.0', impacts: mockMacroImpacts }) : new HttpResponse(null, { status: 404 });
|
||||||
}),
|
}),
|
||||||
http.get('/api/macro/impacts/:ticker', () => HttpResponse.json(mockMacroImpacts)),
|
http.get('/api/macro/impacts/:ticker', () => HttpResponse.json({ exposure_profile: null, impacts: mockMacroImpacts })),
|
||||||
http.get('/api/admin/macro/status', () => HttpResponse.json({ macro_enabled: true, source: 'default' })),
|
http.get('/api/admin/macro/status', () => HttpResponse.json({ macro_enabled: true, source: 'default' })),
|
||||||
http.put('/api/admin/macro/toggle', async ({ request }) => {
|
http.put('/api/admin/macro/toggle', async ({ request }) => {
|
||||||
const body = await request.json() as Record<string, unknown>;
|
const body = await request.json() as Record<string, unknown>;
|
||||||
|
|||||||
Reference in New Issue
Block a user