|
1 | 1 | import { getAttemptCompletionDescription } from "../attempt-completion" |
2 | | -import { EXPERIMENT_IDS } from "../../../../shared/experiments" |
3 | 2 |
|
4 | | -describe("getAttemptCompletionDescription - DISABLE_COMPLETION_COMMAND experiment", () => { |
5 | | - describe("when experiment is disabled (default)", () => { |
6 | | - it("should include command parameter in the description", () => { |
7 | | - const args = { |
8 | | - cwd: "/test/path", |
9 | | - supportsComputerUse: false, |
10 | | - experiments: { |
11 | | - [EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: false, |
12 | | - }, |
13 | | - } |
14 | | - |
15 | | - const description = getAttemptCompletionDescription(args) |
16 | | - |
17 | | - // Check that command parameter is included |
18 | | - expect(description).toContain("- command: (optional)") |
19 | | - expect(description).toContain("A CLI command to execute to show a live demo") |
20 | | - expect(description).toContain("<command>Command to demonstrate result (optional)</command>") |
21 | | - expect(description).toContain("<command>open index.html</command>") |
22 | | - }) |
23 | | - |
24 | | - it("should include command parameter when experiments is undefined", () => { |
25 | | - const args = { |
26 | | - cwd: "/test/path", |
27 | | - supportsComputerUse: false, |
28 | | - } |
29 | | - |
30 | | - const description = getAttemptCompletionDescription(args) |
31 | | - |
32 | | - // Check that command parameter is included |
33 | | - expect(description).toContain("- command: (optional)") |
34 | | - expect(description).toContain("A CLI command to execute to show a live demo") |
35 | | - expect(description).toContain("<command>Command to demonstrate result (optional)</command>") |
36 | | - expect(description).toContain("<command>open index.html</command>") |
37 | | - }) |
38 | | - |
39 | | - it("should include command parameter when no args provided", () => { |
40 | | - const description = getAttemptCompletionDescription() |
41 | | - |
42 | | - // Check that command parameter is included |
43 | | - expect(description).toContain("- command: (optional)") |
44 | | - expect(description).toContain("A CLI command to execute to show a live demo") |
45 | | - expect(description).toContain("<command>Command to demonstrate result (optional)</command>") |
46 | | - expect(description).toContain("<command>open index.html</command>") |
47 | | - }) |
| 3 | +describe("getAttemptCompletionDescription", () => { |
| 4 | + it("should NOT include command parameter in the description", () => { |
| 5 | + const args = { |
| 6 | + cwd: "/test/path", |
| 7 | + supportsComputerUse: false, |
| 8 | + } |
| 9 | + |
| 10 | + const description = getAttemptCompletionDescription(args) |
| 11 | + |
| 12 | + // Check that command parameter is NOT included (permanently disabled) |
| 13 | + expect(description).not.toContain("- command: (optional)") |
| 14 | + expect(description).not.toContain("A CLI command to execute to show a live demo") |
| 15 | + expect(description).not.toContain("<command>Command to demonstrate result (optional)</command>") |
| 16 | + expect(description).not.toContain("<command>open index.html</command>") |
| 17 | + |
| 18 | + // But should still have the basic structure |
| 19 | + expect(description).toContain("## attempt_completion") |
| 20 | + expect(description).toContain("- result: (required)") |
| 21 | + expect(description).toContain("<attempt_completion>") |
| 22 | + expect(description).toContain("</attempt_completion>") |
48 | 23 | }) |
49 | 24 |
|
50 | | - describe("when experiment is enabled", () => { |
51 | | - it("should NOT include command parameter in the description", () => { |
52 | | - const args = { |
53 | | - cwd: "/test/path", |
54 | | - supportsComputerUse: false, |
55 | | - experiments: { |
56 | | - [EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: true, |
57 | | - }, |
58 | | - } |
59 | | - |
60 | | - const description = getAttemptCompletionDescription(args) |
| 25 | + it("should work when no args provided", () => { |
| 26 | + const description = getAttemptCompletionDescription() |
61 | 27 |
|
62 | | - // Check that command parameter is NOT included |
63 | | - expect(description).not.toContain("- command: (optional)") |
64 | | - expect(description).not.toContain("A CLI command to execute to show a live demo") |
65 | | - expect(description).not.toContain("<command>Command to demonstrate result (optional)</command>") |
66 | | - expect(description).not.toContain("<command>open index.html</command>") |
| 28 | + // Check that command parameter is NOT included (permanently disabled) |
| 29 | + expect(description).not.toContain("- command: (optional)") |
| 30 | + expect(description).not.toContain("A CLI command to execute to show a live demo") |
| 31 | + expect(description).not.toContain("<command>Command to demonstrate result (optional)</command>") |
| 32 | + expect(description).not.toContain("<command>open index.html</command>") |
67 | 33 |
|
68 | | - // But should still have the basic structure |
69 | | - expect(description).toContain("## attempt_completion") |
70 | | - expect(description).toContain("- result: (required)") |
71 | | - expect(description).toContain("<attempt_completion>") |
72 | | - expect(description).toContain("</attempt_completion>") |
73 | | - }) |
| 34 | + // But should still have the basic structure |
| 35 | + expect(description).toContain("## attempt_completion") |
| 36 | + expect(description).toContain("- result: (required)") |
| 37 | + expect(description).toContain("<attempt_completion>") |
| 38 | + expect(description).toContain("</attempt_completion>") |
| 39 | + }) |
74 | 40 |
|
75 | | - it("should show example without command", () => { |
76 | | - const args = { |
77 | | - cwd: "/test/path", |
78 | | - supportsComputerUse: false, |
79 | | - experiments: { |
80 | | - [EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: true, |
81 | | - }, |
82 | | - } |
| 41 | + it("should show example without command", () => { |
| 42 | + const args = { |
| 43 | + cwd: "/test/path", |
| 44 | + supportsComputerUse: false, |
| 45 | + } |
83 | 46 |
|
84 | | - const description = getAttemptCompletionDescription(args) |
| 47 | + const description = getAttemptCompletionDescription(args) |
85 | 48 |
|
86 | | - // Check example format |
87 | | - expect(description).toContain("Example: Requesting to attempt completion with a result") |
88 | | - expect(description).toContain("I've updated the CSS") |
89 | | - expect(description).not.toContain("Example: Requesting to attempt completion with a result and command") |
90 | | - }) |
| 49 | + // Check example format |
| 50 | + expect(description).toContain("Example: Requesting to attempt completion with a result") |
| 51 | + expect(description).toContain("I've updated the CSS") |
| 52 | + expect(description).not.toContain("Example: Requesting to attempt completion with a result and command") |
91 | 53 | }) |
92 | 54 |
|
93 | | - describe("description content", () => { |
94 | | - it("should maintain core functionality description regardless of experiment", () => { |
95 | | - const argsWithExperimentDisabled = { |
96 | | - cwd: "/test/path", |
97 | | - supportsComputerUse: false, |
98 | | - experiments: { |
99 | | - [EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: false, |
100 | | - }, |
101 | | - } |
102 | | - |
103 | | - const argsWithExperimentEnabled = { |
104 | | - cwd: "/test/path", |
105 | | - supportsComputerUse: false, |
106 | | - experiments: { |
107 | | - [EXPERIMENT_IDS.DISABLE_COMPLETION_COMMAND]: true, |
108 | | - }, |
109 | | - } |
110 | | - |
111 | | - const descriptionDisabled = getAttemptCompletionDescription(argsWithExperimentDisabled) |
112 | | - const descriptionEnabled = getAttemptCompletionDescription(argsWithExperimentEnabled) |
| 55 | + it("should contain core functionality description", () => { |
| 56 | + const description = getAttemptCompletionDescription() |
113 | 57 |
|
114 | | - // Both should contain core functionality |
115 | | - const coreText = "After each tool use, the user will respond with the result of that tool use" |
116 | | - expect(descriptionDisabled).toContain(coreText) |
117 | | - expect(descriptionEnabled).toContain(coreText) |
| 58 | + // Should contain core functionality |
| 59 | + const coreText = "After each tool use, the user will respond with the result of that tool use" |
| 60 | + expect(description).toContain(coreText) |
118 | 61 |
|
119 | | - // Both should contain the important note |
120 | | - const importantNote = "IMPORTANT NOTE: This tool CANNOT be used until you've confirmed" |
121 | | - expect(descriptionDisabled).toContain(importantNote) |
122 | | - expect(descriptionEnabled).toContain(importantNote) |
| 62 | + // Should contain the important note |
| 63 | + const importantNote = "IMPORTANT NOTE: This tool CANNOT be used until you've confirmed" |
| 64 | + expect(description).toContain(importantNote) |
123 | 65 |
|
124 | | - // Both should contain result parameter |
125 | | - expect(descriptionDisabled).toContain("- result: (required)") |
126 | | - expect(descriptionEnabled).toContain("- result: (required)") |
127 | | - }) |
| 66 | + // Should contain result parameter |
| 67 | + expect(description).toContain("- result: (required)") |
128 | 68 | }) |
129 | 69 | }) |
0 commit comments