Added test to ensure all operations are in a category. Added various operations to categories.

This commit is contained in:
n1474335 2019-10-16 15:10:03 +01:00
parent b28a891a40
commit 4d1f970105
5 changed files with 39 additions and 10 deletions

View File

@ -123,6 +123,7 @@
"Generate PGP Key Pair", "Generate PGP Key Pair",
"PGP Encrypt", "PGP Encrypt",
"PGP Decrypt", "PGP Decrypt",
"PGP Verify",
"PGP Encrypt and Sign", "PGP Encrypt and Sign",
"PGP Decrypt and Verify", "PGP Decrypt and Verify",
"Parse SSH Host Key" "Parse SSH Host Key"
@ -284,6 +285,7 @@
"Zip", "Zip",
"Unzip", "Unzip",
"Bzip2 Decompress", "Bzip2 Decompress",
"Bzip2 Compress",
"Tar", "Tar",
"Untar" "Untar"
] ]
@ -370,6 +372,7 @@
"Detect File Type", "Detect File Type",
"Scan for Embedded Files", "Scan for Embedded Files",
"Extract Files", "Extract Files",
"YARA Rules",
"Remove EXIF", "Remove EXIF",
"Extract EXIF", "Extract EXIF",
"Extract RGBA", "Extract RGBA",
@ -401,6 +404,7 @@
"Cover Image", "Cover Image",
"Image Hue/Saturation/Lightness", "Image Hue/Saturation/Lightness",
"Sharpen Image", "Sharpen Image",
"Normalise Image",
"Convert Image Format", "Convert Image Format",
"Add Text To Image", "Add Text To Image",
"Hex Density chart", "Hex Density chart",

View File

@ -13,13 +13,14 @@
import { import {
setLongTestFailure, setLongTestFailure,
logTestReport, logTestReport,
} from "../lib/utils"; } from "../lib/utils.mjs";
import TestRegister from "../lib/TestRegister.mjs"; import TestRegister from "../lib/TestRegister.mjs";
import "./tests/nodeApi"; import "./tests/nodeApi.mjs";
import "./tests/operations"; import "./tests/operations.mjs";
import "./tests/File"; import "./tests/File.mjs";
import "./tests/NodeDish"; import "./tests/Dish.mjs";
import "./tests/NodeDish.mjs";
const testStatus = { const testStatus = {
allTestsPassing: true, allTestsPassing: true,

View File

@ -1,6 +1,6 @@
import TestRegister from "../../lib/TestRegister.mjs"; import TestRegister from "../../lib/TestRegister.mjs";
import Dish from "../../src/core/Dish.mjs"; import Dish from "../../../src/core/Dish.mjs";
import it from "../node/assertionHandler.mjs"; import it from "../../node/assertionHandler.mjs";
import assert from "assert"; import assert from "assert";
TestRegister.addApiTests([ TestRegister.addApiTests([

View File

@ -0,0 +1,19 @@
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 assert from "assert";
TestRegister.addApiTests([
it("Categories: operations should be in a category", () => {
const catOps = [];
Categories.forEach(cat => {
catOps.push(...cat.ops);
});
for (const op in OperationConfig) {
assert(catOps.includes(op), `'${op}' operation is not present in any category`);
}
}),
]);

View File

@ -17,6 +17,11 @@ import {
} from "../lib/utils.mjs"; } from "../lib/utils.mjs";
import TestRegister from "../lib/TestRegister.mjs"; import TestRegister from "../lib/TestRegister.mjs";
// Generic tests
import "./Categories.mjs";
// Operation tests
import "./tests/BCD.mjs"; import "./tests/BCD.mjs";
import "./tests/BSON.mjs"; import "./tests/BSON.mjs";
import "./tests/BaconCipher.mjs"; import "./tests/BaconCipher.mjs";
@ -95,9 +100,6 @@ import "./tests/ParseUDP.mjs";
// Cannot test operations that use the File type yet // Cannot test operations that use the File type yet
// import "./tests/SplitColourChannels.mjs"; // import "./tests/SplitColourChannels.mjs";
// import "./tests/nodeApi/nodeApi.mjs";
// import "./tests/nodeApi/ops.mjs";
const testStatus = { const testStatus = {
allTestsPassing: true, allTestsPassing: true,
counts: { counts: {
@ -109,5 +111,8 @@ setLongTestFailure();
const logOpsTestReport = logTestReport.bind(null, testStatus); const logOpsTestReport = logTestReport.bind(null, testStatus);
TestRegister.runApiTests()
.then(logOpsTestReport);
TestRegister.runTests() TestRegister.runTests()
.then(logOpsTestReport); .then(logOpsTestReport);