diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-08 21:03:50 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-08 21:03:50 +0000 |
| commit | 632ea5a44731af94b6238f330a3b5440906c8ae7 (patch) | |
| tree | d8c780412598d66b89ef390b5729e379fdfd9d5b /web/test/filter-tabs.test.mjs | |
| parent | 406247b14985ab57902e8e42898dc8cb8960290d (diff) | |
| parent | 93a4c852bf726b00e8014d385165f847763fa214 (diff) | |
merge: pull latest from master and resolve conflicts
- Resolve conflicts in API server, CLI, and executor.
- Maintain Gemini classification and assignment logic.
- Update UI to use generic agent config and project_dir.
- Fix ProjectDir/WorkingDir inconsistencies in Gemini runner.
- All tests passing after merge.
Diffstat (limited to 'web/test/filter-tabs.test.mjs')
| -rw-r--r-- | web/test/filter-tabs.test.mjs | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/web/test/filter-tabs.test.mjs b/web/test/filter-tabs.test.mjs index 44cfaf6..3a4e569 100644 --- a/web/test/filter-tabs.test.mjs +++ b/web/test/filter-tabs.test.mjs @@ -1,9 +1,5 @@ // filter-tabs.test.mjs — TDD contract tests for filterTasksByTab // -// filterTasksByTab is defined inline here to establish expected behaviour. -// Once filterTasksByTab is exported from web/app.js, remove the inline -// definition and import it instead. -// // Run with: node --test web/test/filter-tabs.test.mjs import { describe, it } from 'node:test'; @@ -45,15 +41,45 @@ describe('filterTasksByTab — active tab', () => { }); }); +describe('filterTasksByTab — interrupted tab', () => { + it('includes CANCELLED and FAILED', () => { + const tasks = ALL_STATES.map(makeTask); + const result = filterTasksByTab(tasks, 'interrupted'); + for (const state of ['CANCELLED', 'FAILED']) { + assert.ok(result.some(t => t.state === state), `${state} should be included`); + } + }); + + it('excludes all non-interrupted states', () => { + const tasks = ALL_STATES.map(makeTask); + const result = filterTasksByTab(tasks, 'interrupted'); + for (const state of ['PENDING', 'QUEUED', 'RUNNING', 'READY', 'BLOCKED', 'COMPLETED', 'TIMED_OUT', 'BUDGET_EXCEEDED']) { + assert.ok(!result.some(t => t.state === state), `${state} should be excluded`); + } + }); + + it('returns empty array for empty input', () => { + assert.deepEqual(filterTasksByTab([], 'interrupted'), []); + }); +}); + describe('filterTasksByTab — done tab', () => { - it('includes COMPLETED, FAILED, TIMED_OUT, CANCELLED, BUDGET_EXCEEDED', () => { + it('includes COMPLETED, TIMED_OUT, BUDGET_EXCEEDED', () => { const tasks = ALL_STATES.map(makeTask); const result = filterTasksByTab(tasks, 'done'); - for (const state of ['COMPLETED', 'FAILED', 'TIMED_OUT', 'CANCELLED', 'BUDGET_EXCEEDED']) { + for (const state of ['COMPLETED', 'TIMED_OUT', 'BUDGET_EXCEEDED']) { assert.ok(result.some(t => t.state === state), `${state} should be included`); } }); + it('excludes CANCELLED and FAILED (moved to interrupted tab)', () => { + const tasks = ALL_STATES.map(makeTask); + const result = filterTasksByTab(tasks, 'done'); + for (const state of ['CANCELLED', 'FAILED']) { + assert.ok(!result.some(t => t.state === state), `${state} should be excluded from done`); + } + }); + it('excludes PENDING, QUEUED, RUNNING, READY, BLOCKED', () => { const tasks = ALL_STATES.map(makeTask); const result = filterTasksByTab(tasks, 'done'); |
