Skip to content

Commit 3a90876

Browse files
committed
Test positive/negative of a rule
1 parent 15eab5a commit 3a90876

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/engine.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ describe('rules engine', () => {
2222
then: {
2323
actions: [{ type: 'log', params: { message: 'Hi friend!' } }],
2424
},
25+
otherwise: {
26+
actions: [{ type: 'call', params: { message: 'Who are you?' } }],
27+
},
2528
},
2629
};
2730
engine.setRules(rules);
@@ -30,6 +33,7 @@ describe('rules engine', () => {
3033
log.mockClear();
3134
await engine.run({ firstName: 'Bill' });
3235
expect(log).not.toHaveBeenCalled();
36+
expect(call).toHaveBeenCalledWith({ message: 'Who are you?' });
3337
});
3438

3539
it('should access a property via path', async () => {

0 commit comments

Comments
 (0)