fix: Chat.test.tsx type errors from 271 merge

Cast lastSendChatArgs through unknown to satisfy TypeScript's
strict type narrowing on the nullable union type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dave
2026-03-18 11:33:54 +00:00
parent 15645a2a3e
commit aba0fac26d

View File

@@ -631,7 +631,7 @@ describe("Chat localStorage persistence (Story 145)", () => {
// Verify sendChat was called with ALL prior messages + the new one // Verify sendChat was called with ALL prior messages + the new one
expect(lastSendChatArgs).not.toBeNull(); expect(lastSendChatArgs).not.toBeNull();
const args = lastSendChatArgs as NonNullable<typeof lastSendChatArgs>; const args = lastSendChatArgs as unknown as { messages: Message[]; config: unknown };
expect(args.messages).toHaveLength(3); expect(args.messages).toHaveLength(3);
expect(args.messages[0]).toEqual({ expect(args.messages[0]).toEqual({
role: "user", role: "user",
@@ -1350,7 +1350,7 @@ describe("Bug 264: Claude Code session ID persisted across browser refresh", ()
expect(lastSendChatArgs).not.toBeNull(); expect(lastSendChatArgs).not.toBeNull();
expect( expect(
(lastSendChatArgs?.config as Record<string, unknown>).session_id, ((lastSendChatArgs as unknown as { messages: Message[]; config: unknown })?.config as Record<string, unknown>).session_id,
).toBe("persisted-session-xyz"); ).toBe("persisted-session-xyz");
}); });