Skip to content

Commit 7a78c15

Browse files
committed
Fix WORKSPACE_EXECUTE_BASH API usage in test
- Use .data.output instead of .result.stdout (which doesn't exist) - Add .data.success checks as per API structure - Remove unused readStream() helper function - Remove timeout_secs param (not needed for WORKSPACE_EXECUTE_BASH) This matches the actual API used in other tests (e.g., executeBash.test.ts)
1 parent a43afa1 commit 7a78c15

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed

tests/ipcMain/createWorkspace.test.ts

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,6 @@ async function commitChanges(repoPath: string, message: string): Promise<void> {
119119
});
120120
}
121121

122-
/**
123-
* Read a ReadableStream to a string
124-
*/
125-
async function readStream(stream: ReadableStream<Uint8Array>): Promise<string> {
126-
const reader = stream.getReader();
127-
const decoder = new TextDecoder();
128-
let result = "";
129-
try {
130-
while (true) {
131-
const { done, value } = await reader.read();
132-
if (done) break;
133-
result += decoder.decode(value, { stream: true });
134-
}
135-
} finally {
136-
reader.releaseLock();
137-
}
138-
return result;
139-
}
140-
141122
/**
142123
* Create workspace and handle cleanup on test failure
143124
* Returns result and cleanup function
@@ -347,34 +328,31 @@ describeIntegration("WORKSPACE_CREATE with both runtimes", () => {
347328
const checkTrunkFileResult = await env.mockIpcRenderer.invoke(
348329
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
349330
result.metadata.id,
350-
`test -f trunk-file.txt && echo "exists" || echo "missing"`,
351-
{ timeout_secs: 10 }
331+
`test -f trunk-file.txt && echo "exists" || echo "missing"`
352332
);
353333
expect(checkTrunkFileResult.success).toBe(true);
354-
const trunkFileOutput = await readStream(checkTrunkFileResult.result.stdout);
355-
expect(trunkFileOutput.trim()).toBe("exists");
334+
expect(checkTrunkFileResult.data.success).toBe(true);
335+
expect(checkTrunkFileResult.data.output.trim()).toBe("exists");
356336

357337
// Check that other-file.txt does NOT exist (from other-branch)
358338
const checkOtherFileResult = await env.mockIpcRenderer.invoke(
359339
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
360340
result.metadata.id,
361-
`test -f other-file.txt && echo "exists" || echo "missing"`,
362-
{ timeout_secs: 10 }
341+
`test -f other-file.txt && echo "exists" || echo "missing"`
363342
);
364343
expect(checkOtherFileResult.success).toBe(true);
365-
const otherFileOutput = await readStream(checkOtherFileResult.result.stdout);
366-
expect(otherFileOutput.trim()).toBe("missing");
344+
expect(checkOtherFileResult.data.success).toBe(true);
345+
expect(checkOtherFileResult.data.output.trim()).toBe("missing");
367346

368347
// Verify git log shows the custom trunk commit
369348
const gitLogResult = await env.mockIpcRenderer.invoke(
370349
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
371350
result.metadata.id,
372-
`git log --oneline --all`,
373-
{ timeout_secs: 10 }
351+
`git log --oneline --all`
374352
);
375353
expect(gitLogResult.success).toBe(true);
376-
const logOutput = await readStream(gitLogResult.result.stdout);
377-
expect(logOutput).toContain("Custom trunk commit");
354+
expect(gitLogResult.data.success).toBe(true);
355+
expect(gitLogResult.data.output).toContain("Custom trunk commit");
378356

379357
await cleanup();
380358
} finally {

0 commit comments

Comments
 (0)