Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit f64e1c8

Browse files
feat(aider): refine test for Aider command execution to verify all required flags and output messages
1 parent 3b4781d commit f64e1c8

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

aider/main.test.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describe("aider", async () => {
110110
);
111111
});
112112

113-
it("passes message with --yes-always flag when prompt is provided", async () => {
113+
it("passes aider cmd with correct flags when prompt is provided", async () => {
114114
const state = await runTerraformApply(import.meta.dir, {
115115
agent_id: "foo",
116116
});
@@ -129,26 +129,42 @@ describe("aider", async () => {
129129
console.log("DEBUG OUTPUT LINES:");
130130
output.stdout.forEach((line) => console.log(`> ${line}`));
131131

132-
// Check if script contains the proper command construction with --message and --yes-always flags
132+
// Check if script contains the proper command construction with all required flags
133133
const instance = findResourceInstance(state, "coder_script");
134134

135-
// Verify the script uses --yes-always flag
136-
expect(instance.script.includes("aider --yes-always")).toBe(true);
135+
// Verify all required flags are present in the aider command
136+
expect(
137+
instance.script.includes(
138+
"aider --architect --yes-always --read CONVENTIONS.md --message",
139+
),
140+
).toBe(true);
137141

138-
// Verify the script uses --message flag
139-
expect(instance.script.includes("--message")).toBe(true);
142+
// Verify the expected message format is correct
143+
expect(
144+
instance.script.includes(
145+
'--message "Report each step to Coder. Your task: $CODER_MCP_AIDER_TASK_PROMPT"',
146+
),
147+
).toBe(true);
140148

141149
// Verify the script creates a flag file to prevent duplicate execution
142150
expect(instance.script.includes('touch "$HOME/.aider_task_executed"')).toBe(
143151
true,
144152
);
145153

146-
// Verify the output shows the right message
154+
// Verify logging to the aider log file
155+
expect(instance.script.includes('| tee -a "$HOME/.aider.log"')).toBe(true);
156+
157+
// Verify the output shows the right message for screen session
147158
expect(
148159
output.stdout.some((line) =>
149160
line.includes("Running Aider with message in screen session"),
150161
),
151162
).toBe(true);
163+
164+
// Verify the appropriate starting message is shown
165+
expect(output.stdout).toContain(
166+
"Aider task started in screen session 'aider'. Check the logs for progress.",
167+
);
152168
});
153169

154170
it("executes pre and post install scripts", async () => {

0 commit comments

Comments
 (0)