This commit is contained in:
Ryan Chernoff 2025-05-16 11:18:15 -04:00 committed by GitHub
commit 50db810c6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 7 deletions

View file

@ -989,6 +989,27 @@ 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, filterKey: false });
}, /Invalid Characters in key/);
});
}),
it("XOR: should not throw 'Invalid Characters in key' error when key contains only valid characters", () => {
assert.strictEqual(chef.XOR("fe023da5", {
key: "736f6d65",
filterKey: false
}).toString(),
"\u0015\n]W@\u000b\fP");
}),
it("XPath expression", () => {
assert.strictEqual(
chef.XPathExpression("<contact-info><company>abc</company></contact-info>", {xPath: "contact-info/company"}).toString(),