-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updateWorkflowContext function now accepts updater function or …
…new context value fix #15
- Loading branch information
Showing
5 changed files
with
475 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
223 changes: 223 additions & 0 deletions
223
src/__tests__/__snapshots__/update-workflow-context.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`handles context update when updater function is passed 1`] = ` | ||
{ | ||
"conditions": [ | ||
{ | ||
"marking": 0, | ||
"name": "start", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"marking": 0, | ||
"name": "end", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
], | ||
"tasks": [ | ||
{ | ||
"generation": 1, | ||
"name": "t1", | ||
"state": "started", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
], | ||
"workItems": [], | ||
"workflows": [ | ||
{ | ||
"context": { | ||
"count": 2, | ||
}, | ||
"id": "workflow-1", | ||
"name": "activities", | ||
"parent": null, | ||
"state": "started", | ||
}, | ||
], | ||
} | ||
`; | ||
|
||
exports[`handles context update when value is passed 1`] = ` | ||
{ | ||
"conditions": [ | ||
{ | ||
"marking": 0, | ||
"name": "start", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"marking": 0, | ||
"name": "end", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
], | ||
"tasks": [ | ||
{ | ||
"generation": 1, | ||
"name": "t1", | ||
"state": "started", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
], | ||
"workItems": [], | ||
"workflows": [ | ||
{ | ||
"context": { | ||
"count": 2, | ||
}, | ||
"id": "workflow-1", | ||
"name": "activities", | ||
"parent": null, | ||
"state": "started", | ||
}, | ||
], | ||
} | ||
`; | ||
|
||
exports[`handles parent context update when updater function is passed 1`] = ` | ||
{ | ||
"conditions": [ | ||
{ | ||
"marking": 0, | ||
"name": "start", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"marking": 0, | ||
"name": "end", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"marking": 1, | ||
"name": "start", | ||
"workflowId": "workflow-2", | ||
"workflowName": "sub", | ||
}, | ||
{ | ||
"marking": 0, | ||
"name": "end", | ||
"workflowId": "workflow-2", | ||
"workflowName": "sub", | ||
}, | ||
], | ||
"tasks": [ | ||
{ | ||
"generation": 1, | ||
"name": "t1", | ||
"state": "started", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"generation": 0, | ||
"name": "subT1", | ||
"state": "enabled", | ||
"workflowId": "workflow-2", | ||
"workflowName": "sub", | ||
}, | ||
], | ||
"workItems": [], | ||
"workflows": [ | ||
{ | ||
"context": { | ||
"count": 1, | ||
}, | ||
"id": "workflow-1", | ||
"name": "activities", | ||
"parent": null, | ||
"state": "started", | ||
}, | ||
{ | ||
"context": undefined, | ||
"id": "workflow-2", | ||
"name": "sub", | ||
"parent": { | ||
"taskGeneration": 1, | ||
"taskName": "t1", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
"state": "started", | ||
}, | ||
], | ||
} | ||
`; | ||
|
||
exports[`handles parent context update when value is passed 1`] = ` | ||
{ | ||
"conditions": [ | ||
{ | ||
"marking": 0, | ||
"name": "start", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"marking": 0, | ||
"name": "end", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"marking": 1, | ||
"name": "start", | ||
"workflowId": "workflow-2", | ||
"workflowName": "sub", | ||
}, | ||
{ | ||
"marking": 0, | ||
"name": "end", | ||
"workflowId": "workflow-2", | ||
"workflowName": "sub", | ||
}, | ||
], | ||
"tasks": [ | ||
{ | ||
"generation": 1, | ||
"name": "t1", | ||
"state": "started", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
{ | ||
"generation": 0, | ||
"name": "subT1", | ||
"state": "enabled", | ||
"workflowId": "workflow-2", | ||
"workflowName": "sub", | ||
}, | ||
], | ||
"workItems": [], | ||
"workflows": [ | ||
{ | ||
"context": { | ||
"count": 1, | ||
}, | ||
"id": "workflow-1", | ||
"name": "activities", | ||
"parent": null, | ||
"state": "started", | ||
}, | ||
{ | ||
"context": undefined, | ||
"id": "workflow-2", | ||
"name": "sub", | ||
"parent": { | ||
"taskGeneration": 1, | ||
"taskName": "t1", | ||
"workflowId": "workflow-1", | ||
"workflowName": "activities", | ||
}, | ||
"state": "started", | ||
}, | ||
], | ||
} | ||
`; |
Oops, something went wrong.