diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-06 23:55:07 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-06 23:55:07 +0000 |
| commit | fd42a54d96fcd3342941caaeb61a4b0d5d3f1b4f (patch) | |
| tree | 0b9ef3b7f0ac3981aa310435d014c9f5e21089d4 /web/test/task-actions.test.mjs | |
| parent | 7d4890cde802974b94db24071f63e7733c3670fd (diff) | |
recover: restore untracked work from recovery branch (no Gemini changes)
Recovered files with no Claude→Agent contamination:
- docs/adr/002-task-state-machine.md
- internal/api/logs.go/logs_test.go: task-level log streaming endpoint
- internal/api/validate.go/validate_test.go: POST /api/tasks/validate
- internal/api/server_test.go, storage/db_test.go: expanded test coverage
- scripts/reset-failed-tasks, reset-running-tasks
- web/app.js, index.html, style.css: frontend improvements
- web/test/: active-tasks-tab, delete-button, filter-tabs, sort-tasks tests
Manually applied from server.go diff (skipping Claude→Agent rename):
- taskLogStore field + validateCmdPath field
- DELETE /api/tasks/{id} route + handleDeleteTask
- GET /api/tasks/{id}/logs/stream route
- POST /api/tasks/{id}/resume route + handleResumeTimedOutTask
- handleCancelTask: allow cancelling PENDING/QUEUED tasks directly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'web/test/task-actions.test.mjs')
| -rw-r--r-- | web/test/task-actions.test.mjs | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/web/test/task-actions.test.mjs b/web/test/task-actions.test.mjs index 2df6523..36c0e8b 100644 --- a/web/test/task-actions.test.mjs +++ b/web/test/task-actions.test.mjs @@ -1,4 +1,4 @@ -// task-actions.test.mjs — button visibility logic for Cancel/Restart actions +// task-actions.test.mjs — button visibility logic for Cancel/Restart/Resume actions // // Run with: node --test web/test/task-actions.test.mjs @@ -7,16 +7,23 @@ import assert from 'node:assert/strict'; // ── Logic under test ────────────────────────────────────────────────────────── -const RESTART_STATES = new Set(['FAILED', 'TIMED_OUT', 'CANCELLED']); +const RESTART_STATES = new Set(['FAILED', 'CANCELLED']); function getCardAction(state) { if (state === 'PENDING') return 'run'; if (state === 'RUNNING') return 'cancel'; if (state === 'READY') return 'approve'; + if (state === 'TIMED_OUT') return 'resume'; if (RESTART_STATES.has(state)) return 'restart'; return null; } +function getApiEndpoint(state) { + if (state === 'TIMED_OUT') return '/resume'; + if (RESTART_STATES.has(state)) return '/run'; + return null; +} + // ── Tests ───────────────────────────────────────────────────────────────────── describe('task card action buttons', () => { @@ -32,8 +39,8 @@ describe('task card action buttons', () => { assert.equal(getCardAction('FAILED'), 'restart'); }); - it('shows Restart button for TIMED_OUT', () => { - assert.equal(getCardAction('TIMED_OUT'), 'restart'); + it('shows Resume button for TIMED_OUT', () => { + assert.equal(getCardAction('TIMED_OUT'), 'resume'); }); it('shows Restart button for CANCELLED', () => { @@ -56,3 +63,17 @@ describe('task card action buttons', () => { assert.equal(getCardAction('BUDGET_EXCEEDED'), null); }); }); + +describe('task action API endpoints', () => { + it('TIMED_OUT uses /resume endpoint', () => { + assert.equal(getApiEndpoint('TIMED_OUT'), '/resume'); + }); + + it('FAILED uses /run endpoint', () => { + assert.equal(getApiEndpoint('FAILED'), '/run'); + }); + + it('CANCELLED uses /run endpoint', () => { + assert.equal(getApiEndpoint('CANCELLED'), '/run'); + }); +}); |
