toggleString args now additionally accept just input value, taking first option as default.

This commit is contained in:
d98762625 2018-08-31 13:45:12 +01:00
parent f6c4b5073c
commit 7c9ebafd00
2 changed files with 32 additions and 3 deletions

View file

@ -48,6 +48,14 @@ TestRegister.addApiTests([
assert.equal(result.toString(), "aO[^ZS\u000eW\\^cb");
}),
it("ADD: default option toggleString argument", () => {
const result = chef.ADD(3, {
key: "4",
});
assert.strictEqual(result.toString(), "7");
}),
it("addLineNumbers: No arguments", () => {
const result = addLineNumbers("sample input");
assert.equal(result.toString(), "1 sample input");
@ -921,6 +929,23 @@ smothering ampersand abreast
</contact-info>`);
}),
it("XOR: toggleString with default option", () => {
assert.strictEqual(chef.XOR("fe023da5", {
key: "73 6f 6d 65"
}).toString(),
"\u0015\n]W@\u000b\fP");
}),
it("XOR: toggleString with custom option", () => {
assert.strictEqual(chef.XOR("fe023da5", {
key: {
string: "73 6f 6d 65",
option: "utf8",
}
}).toString(),
"QV\u0010\u0004UDWQ");
}),
it("XPath expression", () => {
assert.strictEqual(
chef.XPathExpression("<contact-info><company>abc</company></contact-info>", {xPath: "contact-info/company"}).toString(),