Skip to content

Commit

Permalink
Fix SpEL import not_between (#1050)
Browse files Browse the repository at this point in the history
* Fix SpEL import not_between

* chlog, test
  • Loading branch information
ukrbublik authored May 16, 2024
1 parent 2e1c925 commit 4a64590
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog
- 6.5.1
- Fix missing config file in antd moment date widgets (PR #1046) (issue #1048)
- Fix SpEL import not_between (PR #1050) (issue #1047)
- 6.5.0
- Breaking: `Utils.validateTree` returns array of errors (PR #1034)
- Breaking: `removeIncompleteRulesOnLoad` by default is false
Expand Down
3 changes: 2 additions & 1 deletion packages/core/modules/import/spel.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ const convertOp = (spel, conv, config, meta, parentSpel = null) => {
left,
from,
to
]
],
not: isBetweenRev,
};
return convertOp(oneSpel, conv, config, meta, parentSpel);
}
Expand Down
19 changes: 19 additions & 0 deletions packages/tests/specs/Basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,25 @@ describe("basic query", () => {
}, []);
});

describe("should work with not_between op in SpEL format", () => {
export_checks(configs.simple_with_number, inits.spel_with_not_between, "SpEL", {
logic: {
"and": [
{
"!": {
"<=": [
1,
{ "var": "num" },
2
]
}
}
]
},
spel: "(num < 1 || num > 2)"
}, []);
});

describe("should work with simple value in JsonLogic format not in group", () => {
export_checks(configs.simple_with_number, inits.with_number_not_in_group, "JsonLogic", {
query: "num == 2",
Expand Down
1 change: 1 addition & 0 deletions packages/tests/support/inits.js
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,7 @@ export const with_groupVarKey = {

export const spel_with_number = "num == 2";
export const spel_with_between = "num >= 1 && num <= 2";
export const spel_with_not_between = "(num < 1 || num > 2)";
export const spel_with_not = "!(num == 2)";
export const spel_with_not_not = "!(num == 2 || !(num == 3))";
export const spel_with_cases = "(str == '222' ? is_string : (num == 4 ? is_number : unknown))";
Expand Down

0 comments on commit 4a64590

Please sign in to comment.