Personal Telegram developer console for GitHub
test(cp7): cover workflow pause resume and idempotency
davoodmehraban89 committed
Oct 5, 2026 at 06:21 UTC
963a96401afd1f086e6ee5a4eb62960bad6eba9a
1 file changed
+3
test/automation.test.js
new
+3
@@ -0,0 +1,3 @@
1
+import test from 'node:test';import assert from 'node:assert/strict';import {createAutomation,transitionAutomation}from'../src/core/automation.js';
2
+test('CP7 state machine pauses resumes and completes',()=>{let s=createAutomation({id:'1',ownerId:'o',recipe:'ci-recovery',steps:[{key:'a'},{key:'b'}]});s=transitionAutomation(s,{type:'pause',intent:{key:'a'}});assert.equal(s.status,'awaiting_approval');s=transitionAutomation(s,{type:'resume',key:'a'});s=transitionAutomation(s,{type:'complete_step',key:'a'});assert.equal(s.cursor,1);s=transitionAutomation(s,{type:'complete_step',key:'b'});assert.equal(s.status,'completed');});
3
+test('CP7 idempotency prevents duplicate step effects',()=>{let s=createAutomation({id:'1',ownerId:'o',recipe:'r',steps:[{key:'a'}]});s=transitionAutomation(s,{type:'complete_step',key:'a'});assert.equal(transitionAutomation(s,{type:'inspect'}).status,'completed');assert.throws(()=>transitionAutomation(s,{type:'resume',key:'a'}));});