Spaces:
Paused
Paused
Download src/lib/components/agent/agentQueueMutations.test.ts from Mike0021/chat-ui-agent-demo: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/Mike0021/chat-ui-agent-demo/resolve/main/src/lib/components/agent/agentQueueMutations.test.ts
- Command line
-
hf download hf://spaces/Mike0021/chat-ui-agent-demo/src/lib/components/agent/agentQueueMutations.test.ts
-
curl -L -o agentQueueMutations.test.ts https://huggingface.co/spaces/Mike0021/chat-ui-agent-demo/resolve/main/src/lib/components/agent/agentQueueMutations.test.ts
1.41 kB
| import { describe, expect, it } from "vitest"; | |
| import { | |
| agentQueueMatchesSnapshot, | |
| captureAgentQueueMutationTarget, | |
| createAgentQueueReplacement, | |
| } from "./agentQueueMutations"; | |
| describe("Agent queue mutation targets", () => { | |
| it("keeps an edit bound to the item and snapshot captured when editing began", () => { | |
| const target = captureAgentQueueMutationTarget( | |
| { steering: ["Original item"], followUp: ["Run tests"] }, | |
| "steering", | |
| 0 | |
| ); | |
| if (!target) throw new Error("expected queue target"); | |
| expect( | |
| agentQueueMatchesSnapshot( | |
| { steering: ["Concurrent item", "Original item"], followUp: ["Run tests"] }, | |
| target.expected | |
| ) | |
| ).toBe(false); | |
| expect(createAgentQueueReplacement(target, "edit", "Edited original")).toEqual({ | |
| expected: { steering: ["Original item"], followUp: ["Run tests"] }, | |
| replacement: { steering: ["Edited original"], followUp: ["Run tests"] }, | |
| }); | |
| }); | |
| it("removes the captured item without consulting a later reordered queue", () => { | |
| const target = captureAgentQueueMutationTarget( | |
| { steering: ["Keep first", "Remove second"], followUp: [] }, | |
| "steering", | |
| 1 | |
| ); | |
| if (!target) throw new Error("expected queue target"); | |
| expect(createAgentQueueReplacement(target, "remove")).toEqual({ | |
| expected: { steering: ["Keep first", "Remove second"], followUp: [] }, | |
| replacement: { steering: ["Keep first"], followUp: [] }, | |
| }); | |
| }); | |
| }); | |