Added tests for Utils.parseEscapedChars

This commit is contained in:
n1474335 2019-10-16 17:22:48 +01:00
parent 562171ec86
commit adf9772928
5 changed files with 36 additions and 19 deletions

View file

@ -21,6 +21,8 @@ import "./tests/operations.mjs";
import "./tests/File.mjs";
import "./tests/Dish.mjs";
import "./tests/NodeDish.mjs";
import "./tests/Utils.mjs";
import "./tests/Categories.mjs";
const testStatus = {
allTestsPassing: true,

View file

@ -1,7 +1,7 @@
import TestRegister from "../lib/TestRegister.mjs";
import Categories from "../../src/core/config/Categories.json";
import OperationConfig from "../../src/core/config/OperationConfig.json";
import it from "../node/assertionHandler.mjs";
import TestRegister from "../../lib/TestRegister.mjs";
import Categories from "../../../src/core/config/Categories.json";
import OperationConfig from "../../../src/core/config/OperationConfig.json";
import it from "../assertionHandler.mjs";
import assert from "assert";
TestRegister.addApiTests([

View file

@ -0,0 +1,23 @@
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("\\\\\\'"), "\\'");
}),
]);

View file

@ -17,11 +17,6 @@ import {
} from "../lib/utils.mjs";
import TestRegister from "../lib/TestRegister.mjs";
// Generic tests
import "./Categories.mjs";
// Operation tests
import "./tests/BCD.mjs";
import "./tests/BSON.mjs";
import "./tests/BaconCipher.mjs";
@ -111,8 +106,5 @@ setLongTestFailure();
const logOpsTestReport = logTestReport.bind(null, testStatus);
TestRegister.runApiTests()
.then(logOpsTestReport);
TestRegister.runTests()
.then(logOpsTestReport);