Skip to content

Commit 5e2d177

Browse files
committed
test(app-shell): the last doubles move with the converted calls (headers read off a Headers, the record-lock read)
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2d7fd8f commit 5e2d177

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎ui/packages/app-shell/src/console/ai/__tests__/BuildDebugDrawer.test.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ describe('BuildDebugDrawer', () => {
6464
vi.stubGlobal('fetch', spy);
6565
renderDrawer();
6666
await screen.findByText(/Proposed but never applied/);
67-
expect(spy).toHaveBeenCalledWith('/api/v1/ai/conversations/conv_x/debug', { credentials: 'include' });
67+
// The authenticated fetch hands the wire a `Headers` (the bearer, when one is stored).
68+
expect(spy).toHaveBeenCalledWith('/api/v1/ai/conversations/conv_x/debug', {
69+
credentials: 'include',
70+
headers: expect.any(Headers),
71+
});
6872
});
6973
});

‎ui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.flowChecks-34818.test.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ describe('DraftChangesPanel — the flow publish checks, before the publish (obj
9090
expect(block.textContent).not.toMatch(/flow-decision-unconditional-branch|xin_huiyi_tixing/);
9191
// The read that fed it stated the console's language.
9292
const draftCall = fetchMock.mock.calls.find(
93-
([u, init]) => String(u).includes('state=draft') && (init?.headers as Record<string, string> | undefined)?.['Accept-Language'],
93+
([u, init]) => String(u).includes('state=draft') && new Headers(init?.headers as HeadersInit | undefined).get('Accept-Language'),
9494
);
95-
expect((draftCall![1]!.headers as Record<string, string>)['Accept-Language']).toBe('zh-CN');
95+
// The authenticated fetch hands the wire a `Headers`; the language the read stated is read off it.
96+
expect(new Headers(draftCall![1]!.headers as HeadersInit).get('Accept-Language')).toBe('zh-CN');
9697
});
9798

9899
it('reports without blocking — the Publish button stays live', async () => {

‎ui/packages/app-shell/src/views/RecordDetailView.approvalLock-25934.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { MemoryRouter } from 'react-router-dom';
3737
// The approvals reads go out through the authenticated fetch too; they answer from
3838
// the file's wire double, as before.
3939
const authFetchSpy = vi.fn(async (url: string, init?: RequestInit) =>
40-
String(url).includes('/approvals/requests')
40+
String(url).includes('/approvals/')
4141
? fetch(url, init)
4242
: new Response(JSON.stringify({ data: {} }), {
4343
status: 200,

0 commit comments

Comments
 (0)