diff --git a/docs/superpowers/plans/2026-10-01-ims-admin-refresh-slice-2-capa.md b/docs/superpowers/plans/2026-10-01-ims-admin-refresh-slice-2-capa.md index 7bb3f18..84b2485 100644 --- a/docs/superpowers/plans/2026-10-01-ims-admin-refresh-slice-2-capa.md +++ b/docs/superpowers/plans/2026-10-01-ims-admin-refresh-slice-2-capa.md @@ -1434,7 +1434,8 @@ import { CapaForm } from '@/components/capa/capa-form' const users = [{ id: 'u1', name: 'Tan Mei Ling', department: 'Facilities' }] function stubFetch(postResponse: { ok: boolean; body?: unknown } = { ok: true }) { - const fn = vi.fn(async (url: string) => { + const fn = vi.fn(async (url: string, init?: RequestInit) => { + void init if (url === '/api/users') return { ok: true, json: async () => users } return { ok: postResponse.ok, json: async () => postResponse.body ?? {} } }) @@ -1478,7 +1479,7 @@ describe('CapaForm', () => { fireEvent.change(screen.getByLabelText('Priority'), { target: { value: 'high' } }) fireEvent.submit(container.querySelector('form')!) await waitFor(() => expect(push).toHaveBeenCalledWith('/hse/incidents/inc1')) - expect(JSON.parse(postCall(fn)![1].body as string)).toEqual({ + expect(JSON.parse(postCall(fn)![1]!.body as string)).toEqual({ incident_id: 'inc1', description: 'Re-coat the ramp', owner_user_id: 'u1', diff --git a/tests/components/capa/capa-form.test.tsx b/tests/components/capa/capa-form.test.tsx index 295f2ec..1dd9a29 100644 --- a/tests/components/capa/capa-form.test.tsx +++ b/tests/components/capa/capa-form.test.tsx @@ -10,7 +10,8 @@ import { CapaForm } from '@/components/capa/capa-form' const users = [{ id: 'u1', name: 'Tan Mei Ling', department: 'Facilities' }] function stubFetch(postResponse: { ok: boolean; body?: unknown } = { ok: true }) { - const fn = vi.fn(async (url: string) => { + const fn = vi.fn(async (url: string, init?: RequestInit) => { + void init if (url === '/api/users') return { ok: true, json: async () => users } return { ok: postResponse.ok, json: async () => postResponse.body ?? {} } }) @@ -54,7 +55,7 @@ describe('CapaForm', () => { fireEvent.change(screen.getByLabelText('Priority'), { target: { value: 'high' } }) fireEvent.submit(container.querySelector('form')!) await waitFor(() => expect(push).toHaveBeenCalledWith('/hse/incidents/inc1')) - expect(JSON.parse(postCall(fn)![1].body as string)).toEqual({ + expect(JSON.parse(postCall(fn)![1]!.body as string)).toEqual({ incident_id: 'inc1', description: 'Re-coat the ramp', owner_user_id: 'u1',