feat(chat): persistance bornee du brouillon custom chat par projet/layout (#182)
This commit is contained in:
@ -253,6 +253,33 @@ describe("TauriAgentGateway invoke payloads", () => {
|
||||
expect(out.effect.kind).toBe("cleanConversation");
|
||||
});
|
||||
|
||||
it("wraps chat draft persistence commands with the project/layout/node scope", async () => {
|
||||
const gateway = new TauriAgentGateway();
|
||||
const scope = {
|
||||
projectId: "proj-1",
|
||||
layoutId: "layout-1",
|
||||
nodeId: "node-1",
|
||||
};
|
||||
invoke.mockResolvedValueOnce({ text: "hello", updatedAtMs: 42 });
|
||||
|
||||
await expect(gateway.readChatDraft(scope)).resolves.toEqual({
|
||||
text: "hello",
|
||||
updatedAtMs: 42,
|
||||
});
|
||||
await gateway.saveChatDraft(scope, "edited");
|
||||
await gateway.clearChatDraft(scope);
|
||||
|
||||
expect(invoke).toHaveBeenNthCalledWith(1, "read_chat_draft", {
|
||||
request: scope,
|
||||
});
|
||||
expect(invoke).toHaveBeenNthCalledWith(2, "save_chat_draft", {
|
||||
request: { ...scope, text: "edited" },
|
||||
});
|
||||
expect(invoke).toHaveBeenNthCalledWith(3, "clear_chat_draft", {
|
||||
request: scope,
|
||||
});
|
||||
});
|
||||
|
||||
it("launchAgentChat returns a handle only when launch_agent confirms cellKind chat", async () => {
|
||||
invoke.mockResolvedValueOnce({
|
||||
sessionId: "chat-session-1",
|
||||
|
||||
Reference in New Issue
Block a user