Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import {
4 REMOVE_QUEUED_MESSAGE_ACCESSIBILITY_LABEL,
5 buildCancelQueuedRunCommand,
6 resolveThreadQueueRowControls,
7} from "./threadQueueControlPresentation";
8
9describe("threadQueueControlPresentation", () => {
10 it("preserves queue reorder and steer controls with removal", () => {
11 const controls = resolveThreadQueueRowControls({
12 busy: false,
13 canPromoteToSteer: true,
14 canReorder: true,
15 index: 1,
16 queuedCount: 3,
17 text: "Please review the follow-up change.",
18 });
19
20 expect(controls.displayText).toBe("Please review the follow-up change.");
21 expect(controls.canMoveUp).toBe(true);
22 expect(controls.canMoveDown).toBe(true);
23 expect(controls.canSteer).toBe(true);
24 expect(controls.canDismiss).toBe(true);
25 expect(controls.dismissAccessibilityLabel).toBe(REMOVE_QUEUED_MESSAGE_ACCESSIBILITY_LABEL);
26 });
27
28 it("disables edge reorder controls and busy dismissal", () => {
29 const first = resolveThreadQueueRowControls({
30 busy: false,
31 canPromoteToSteer: false,
32 canReorder: true,
33 index: 0,
34 queuedCount: 2,
35 text: "First",
36 });
37 const busy = resolveThreadQueueRowControls({
38 busy: true,
39 canPromoteToSteer: true,
40 canReorder: true,
41 index: 0,
42 queuedCount: 1,
43 text: "Queued message",
44 });
45
46 expect(first.canMoveUp).toBe(false);
47 expect(first.canMoveDown).toBe(true);
48 expect(first.canSteer).toBe(false);
49 expect(busy.canDismiss).toBe(false);
50 expect(busy.canMoveUp).toBe(false);
51 expect(busy.canSteer).toBe(false);
52 });
53
54 it("builds cancelQueuedRun command arguments for removal", () => {
55 expect(
56 buildCancelQueuedRunCommand({
57 environmentId: "environment:test" as never,
58 runId: "run:queued" as never,
59 threadId: "thread:test" as never,
60 }),
61 ).toEqual({
62 environmentId: "environment:test",
63 input: {
64 runId: "run:queued",
65 threadId: "thread:test",
66 },
67 });
68 });
69});