Skip to content

Commit

Permalink
Merge pull request #29 from ONSdigital/EAR-1345-add-notanyof
Browse files Browse the repository at this point in the history
✨ Add "Not any of" option to binary expressions
  • Loading branch information
tbaggaley authored May 25, 2021
2 parents 448aeda + 5903d86 commit 69692e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/utils/convertRoutingConditions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ const routingConditionConversions = {
LessOrEqual: "less than or equal to",
AllOf: "contains all",
AnyOf: "contains any",
NotAnyOf: "not contains any",
Unanswered: "not set",
OneOf: "equals any"
OneOf: "equals any",
};

const conditionConversion = authorCondition => {
const conditionConversion = (authorCondition) => {
const runnerCondition = routingConditionConversions[authorCondition];
if (!runnerCondition) {
throw new Error(`Unsupported author condition: ${authorCondition}`);
Expand Down
5 changes: 3 additions & 2 deletions src/utils/convertRoutingConditions/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ describe("Convert routing conditions", () => {
GreaterThan: "greater than",
LessThan: "less than",
GreaterOrEqual: "greater than or equal to",
LessOrEqual: "less than or equal to"
LessOrEqual: "less than or equal to",
NotAnyOf: "not contains any",
};
Object.keys(conditionMap).forEach(authorCondition =>
Object.keys(conditionMap).forEach((authorCondition) =>
expect(converter(authorCondition)).toEqual(conditionMap[authorCondition])
);
});
Expand Down

0 comments on commit 69692e8

Please sign in to comment.