Skip to content

Commit

Permalink
Feature/ Controlled Execution
Browse files Browse the repository at this point in the history
- Cleaned up first test case
  • Loading branch information
Sykander committed Nov 17, 2022
1 parent 8ceab06 commit 0653b36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ QUnit.module('basic', () => {

QUnit.test("Expanding functionality with add_operator - controlledExecution", function(assert) {
// assert that controlled execution doesn't do pre-evaluation
var customOp = function(values, data, jsonLogic) {
return jsonLogic.apply(values[0], data);
var customOp = function(values) {
return values[0];
}

jsonLogic.add_operation('customOp', customOp, { controlledExecution: true });

assert.deepEqual(jsonLogic.apply({ customOp: [{ "var": "" }, { "var": "test" }]}, { test: 123 }), { test: 123 });
assert.deepEqual(jsonLogic.apply({ customOp: [{ "var": "test" }, { "var": "" }]}, { test: 123 }), 123);
assert.deepEqual(jsonLogic.apply({ customOp: [{ "var": "" }, { "var": "test" }]}, { test: 123 }), { var: "" });
assert.deepEqual(jsonLogic.apply({ customOp: [{ "var": "test" }, { "var": "" }]}, { test: 123 }), { var: "test" });

// assert that controlled execution custom operators can be removed as normal
jsonLogic.rm_operation('customOp');
Expand Down

0 comments on commit 0653b36

Please sign in to comment.