CyberChef/tests/node/tests/Utils.mjs
みけCAT dd26c09003
Some checks are pending
CodeQL Analysis / Analyze (push) Waiting to run
Master Build, Test & Deploy / main (push) Waiting to run
Exclude Delete character from hex dump output (#2086)
Co-authored-by: GCHQ Developer C85297 <95289555+C85297@users.noreply.github.com>
2026-01-29 15:00:17 +00:00

29 lines
979 B
JavaScript

import TestRegister from "../../lib/TestRegister.mjs";
import Utils from "../../../src/core/Utils.mjs";
import it from "../assertionHandler.mjs";
import assert from "assert";
TestRegister.addApiTests([
it("Utils: should parse six backslashes correctly", () => {
assert.equal(Utils.parseEscapedChars("\\\\\\\\\\\\"), "\\\\\\");
}),
it("Utils: should parse escaped quotes correctly", () => {
assert.equal(Utils.parseEscapedChars("\\'"), "'");
}),
it("Utils: should parse escaped quotes and backslashes correctly", () => {
assert.equal(Utils.parseEscapedChars("\\\\'"), "\\'");
}),
it("Utils: should parse escaped quotes and escaped backslashes correctly", () => {
assert.equal(Utils.parseEscapedChars("\\\\\\'"), "\\'");
}),
it("Utils: should replace delete character", () => {
assert.equal(
Utils.printable("\x7e\x7f\x80\xa7", false, true),
"\x7e...",
);
}),
]);