summaryrefslogtreecommitdiff
path: root/web/test/stats.test.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'web/test/stats.test.mjs')
-rw-r--r--web/test/stats.test.mjs16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/test/stats.test.mjs b/web/test/stats.test.mjs
index a7fe657..19f2b1e 100644
--- a/web/test/stats.test.mjs
+++ b/web/test/stats.test.mjs
@@ -150,4 +150,20 @@ describe('computeExecutionStats', () => {
assert.equal(stats.byOutcome.failed, 1);
assert.equal(stats.byOutcome.cancelled, 1);
});
+
+ // READY is the execution state for a successful top-level (no parent) task
+ // run — see internal/executor.handleRunResult. COMPLETED is only reached
+ // after a separate human/chatbot accept step, so READY must count as
+ // success here or every top-level task's success rate reads as 0.
+ it('counts READY executions as successful', () => {
+ const execs = [makeExec('READY'), makeExec('READY'), makeExec('FAILED')];
+ const stats = computeExecutionStats(execs);
+ assert.equal(stats.successRate, 2 / 3);
+ });
+
+ it('counts real-world uppercase state values the same as lowercase fixtures', () => {
+ const execs = [makeExec('COMPLETED'), makeExec('READY'), makeExec('FAILED'), makeExec('CANCELLED')];
+ const stats = computeExecutionStats(execs);
+ assert.equal(stats.successRate, 0.5);
+ });
});