test: update conversation history test to include sdkSessionId handling

- Renamed test case to clarify that it handles conversation history with sdkSessionId using the resume option.
- Updated assertions to verify that the sdk.query method is called with the correct options when a session ID is provided.
This commit is contained in:
Cody Seibert
2025-12-14 11:10:57 -05:00
parent 5a1fe23ddb
commit 038caeb2a0

View File

@@ -160,7 +160,7 @@ describe("claude-provider.ts", () => {
});
});
it("should handle conversation history", async () => {
it("should handle conversation history with sdkSessionId using resume option", async () => {
vi.mocked(sdk.query).mockReturnValue(
(async function* () {
yield { type: "text", text: "test" };
@@ -176,13 +176,18 @@ describe("claude-provider.ts", () => {
prompt: "Current message",
cwd: "/test",
conversationHistory,
sdkSessionId: "test-session-id",
});
await collectAsyncGenerator(generator);
// Should pass an async generator as prompt
const callArgs = vi.mocked(sdk.query).mock.calls[0][0];
expect(typeof callArgs.prompt).not.toBe("string");
// Should use resume option when sdkSessionId is provided with history
expect(sdk.query).toHaveBeenCalledWith({
prompt: "Current message",
options: expect.objectContaining({
resume: "test-session-id",
}),
});
});
it("should handle array prompt (with images)", async () => {