mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-27 10:16:15 -04:00
Added test to ensure all operations are in a category. Added various operations to categories.
This commit is contained in:
parent
b28a891a40
commit
4d1f970105
5 changed files with 39 additions and 10 deletions
19
tests/operations/Categories.mjs
Normal file
19
tests/operations/Categories.mjs
Normal 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`);
|
||||
}
|
||||
}),
|
||||
|
||||
]);
|
|
@ -1,12 +0,0 @@
|
|||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
import Dish from "../../src/core/Dish.mjs";
|
||||
import it from "../node/assertionHandler.mjs";
|
||||
import assert from "assert";
|
||||
|
||||
TestRegister.addApiTests([
|
||||
it("Dish - presentAs: should exist", () => {
|
||||
const dish = new Dish();
|
||||
assert(dish.presentAs);
|
||||
}),
|
||||
|
||||
]);
|
|
@ -17,6 +17,11 @@ 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";
|
||||
|
@ -95,9 +100,6 @@ import "./tests/ParseUDP.mjs";
|
|||
// Cannot test operations that use the File type yet
|
||||
// import "./tests/SplitColourChannels.mjs";
|
||||
|
||||
// import "./tests/nodeApi/nodeApi.mjs";
|
||||
// import "./tests/nodeApi/ops.mjs";
|
||||
|
||||
const testStatus = {
|
||||
allTestsPassing: true,
|
||||
counts: {
|
||||
|
@ -109,5 +111,8 @@ setLongTestFailure();
|
|||
|
||||
const logOpsTestReport = logTestReport.bind(null, testStatus);
|
||||
|
||||
TestRegister.runApiTests()
|
||||
.then(logOpsTestReport);
|
||||
|
||||
TestRegister.runTests()
|
||||
.then(logOpsTestReport);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue