summaryrefslogtreecommitdiff
path: root/web/test/start-next-task.test.mjs
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-14 00:39:22 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-14 00:39:22 +0000
commit2ee988ccc04c09ceb6de7cdb75c94114e85d01b9 (patch)
tree29100e3e4b33748c544b9a42cb74e964df49b96e /web/test/start-next-task.test.mjs
parent98ccde12b08ad0b7f53e42de959a72d8382179e3 (diff)
feat: add agent selector to UI and support direct agent assignment
- Added an agent selector (Auto, Claude, Gemini) to the Start Next Task button. - Updated the backend to pass query parameters as environment variables to scripts. - Modified the executor pool to skip classification when a specific agent is requested. - Added --agent flag to claudomator start command. - Updated tests to cover the new functionality.
Diffstat (limited to 'web/test/start-next-task.test.mjs')
-rw-r--r--web/test/start-next-task.test.mjs21
1 files changed, 19 insertions, 2 deletions
diff --git a/web/test/start-next-task.test.mjs b/web/test/start-next-task.test.mjs
index 6863f7e..eaf3087 100644
--- a/web/test/start-next-task.test.mjs
+++ b/web/test/start-next-task.test.mjs
@@ -9,8 +9,11 @@ import assert from 'node:assert/strict';
// Returns {output, exit_code} on HTTP 2xx
// Throws on HTTP error
-async function startNextTask(basePath, fetchFn) {
- const res = await fetchFn(`${basePath}/api/scripts/start-next-task`, { method: 'POST' });
+async function startNextTask(basePath, fetchFn, agent) {
+ const url = agent && agent !== 'auto'
+ ? `${basePath}/api/scripts/start-next-task?agent=${agent}`
+ : `${basePath}/api/scripts/start-next-task`;
+ const res = await fetchFn(url, { method: 'POST' });
if (!res.ok) {
let msg = `HTTP ${res.status}`;
try { const body = await res.json(); msg = body.error || msg; } catch {}
@@ -35,6 +38,20 @@ describe('startNextTask', () => {
assert.equal(captured.opts.method, 'POST');
});
+ it('appends agent as query parameter when provided', async () => {
+ let captured = null;
+ const mockFetch = (url, opts) => {
+ captured = { url, opts };
+ return Promise.resolve({
+ ok: true,
+ json: () => Promise.resolve({ output: 'claudomator start --agent claude abc-123\n', exit_code: 0 }),
+ });
+ };
+
+ await startNextTask('http://localhost:8484', mockFetch, 'claude');
+ assert.equal(captured.url, 'http://localhost:8484/api/scripts/start-next-task?agent=claude');
+ });
+
it('returns output and exit_code on success', async () => {
const mockFetch = () => Promise.resolve({
ok: true,