mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
public commit
This commit is contained in:
23
app/__test__/flows/inc/fanout-condition.ts
Normal file
23
app/__test__/flows/inc/fanout-condition.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Condition, Flow } from "../../../src/flows";
|
||||
import { getNamedTask } from "./helper";
|
||||
|
||||
const first = getNamedTask(
|
||||
"first",
|
||||
async () => {
|
||||
//throw new Error("Error");
|
||||
return {
|
||||
inner: {
|
||||
result: 2
|
||||
}
|
||||
};
|
||||
},
|
||||
1000
|
||||
);
|
||||
const second = getNamedTask("second (if match)");
|
||||
const third = getNamedTask("third (if error)");
|
||||
|
||||
const fanout = new Flow("fanout", [first, second, third]);
|
||||
fanout.task(first).asInputFor(third, Condition.error(), 2);
|
||||
fanout.task(first).asInputFor(second, Condition.matches("inner.result", 2));
|
||||
|
||||
export { fanout };
|
||||
Reference in New Issue
Block a user