test(ui): update loadChatHistory tests for limit 25 and chatHistoryTruncated
Made-with: Cursor
This commit is contained in:
parent
1f291ad422
commit
6f4bc797ea
@ -620,14 +620,35 @@ describe("loadChatHistory", () => {
|
||||
|
||||
expect(request).toHaveBeenCalledWith("chat.history", {
|
||||
sessionKey: "main",
|
||||
limit: 200,
|
||||
limit: 25,
|
||||
});
|
||||
expect(state.chatMessages).toEqual([
|
||||
{ role: "assistant", content: [{ type: "text", text: "visible answer" }] },
|
||||
{ role: "user", content: [{ type: "text", text: "NO_REPLY" }] },
|
||||
]);
|
||||
expect(state.chatThinkingLevel).toBe("low");
|
||||
expect(state.chatHistoryTruncated).toBe(false);
|
||||
expect(state.chatLoading).toBe(false);
|
||||
expect(state.lastError).toBeNull();
|
||||
});
|
||||
|
||||
it("sets chatHistoryTruncated when response has at least request limit", async () => {
|
||||
const messages = Array.from({ length: 25 }, (_, i) => ({
|
||||
role: "user",
|
||||
content: [{ type: "text", text: `msg ${i}` }],
|
||||
}));
|
||||
const request = vi.fn().mockResolvedValue({
|
||||
messages,
|
||||
thinkingLevel: null,
|
||||
});
|
||||
const state = createState({
|
||||
connected: true,
|
||||
client: { request } as unknown as ChatState["client"],
|
||||
});
|
||||
|
||||
await loadChatHistory(state);
|
||||
|
||||
expect(state.chatMessages).toHaveLength(25);
|
||||
expect(state.chatHistoryTruncated).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user