From b82426852562551f63ed375cdfb70935c471883e Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 30 Apr 2025 22:00:24 -0400 Subject: [PATCH] fix: revert previous commit wrong file staged, added file with new test for error feature --- src/core/operations/XOR.mjs | 2 +- tests/node/tests/operations.mjs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/operations/XOR.mjs b/src/core/operations/XOR.mjs index c093b433..511a7680 100644 --- a/src/core/operations/XOR.mjs +++ b/src/core/operations/XOR.mjs @@ -46,7 +46,7 @@ class XOR extends Operation { { "name": "Filter Key", "type": "boolean", - "value": false + "value": true } ]; } diff --git a/tests/node/tests/operations.mjs b/tests/node/tests/operations.mjs index 4c5d4ada..ea902ace 100644 --- a/tests/node/tests/operations.mjs +++ b/tests/node/tests/operations.mjs @@ -974,6 +974,19 @@ smothering ampersand abreast`; "QV\u0010\u0004UDWQ"); }), + it("XOR: should throw 'Invalid Characters in key' error when key contains invalid characters", () => { + const invalidKeys = [ + { string: "zz 00 11", option: "Hex" }, + + { string: "4~ 00 11", option: "Hex" } + ]; + invalidKeys.forEach(invalidKey => { + assert.throws(() => { + chef.XOR("fe023da5", { key: invalidKey }); + }, /Invalid Characters in key/); + }); + }), + it("XPath expression", () => { assert.strictEqual( chef.XPathExpression("abc", {xPath: "contact-info/company"}).toString(),