1
0
mirror of synced 2024-11-30 17:34:27 +01:00

Restructured tests directory

This commit is contained in:
n1474335 2018-12-28 21:49:40 +00:00
parent a1b161493c
commit c7e9115994
62 changed files with 122 additions and 135 deletions

View File

@ -30,7 +30,7 @@ module.exports = function (grunt) {
["clean:node", "clean:config", "exec:generateConfig", "webpack:node", "chmod:build"]);
grunt.registerTask("test",
"A task which runs all the tests in test/tests.",
"A task which runs all the tests in the tests directory.",
["exec:generateConfig", "exec:tests"]);
grunt.registerTask("docs",
@ -148,7 +148,7 @@ module.exports = function (grunt) {
core: ["src/core/**/*.{js,mjs}", "!src/core/vendor/**/*", "!src/core/operations/legacy/**/*"],
web: ["src/web/**/*.{js,mjs}"],
node: ["src/node/**/*.{js,mjs}"],
tests: ["test/**/*.{js,mjs}"],
tests: ["tests/**/*.{js,mjs}"],
},
jsdoc: {
options: {
@ -246,19 +246,6 @@ module.exports = function (grunt) {
}),
]
},
tests: {
mode: "development",
target: "node",
entry: "./test/index.mjs",
externals: [NodeExternals()],
output: {
filename: "index.js",
path: __dirname + "/build/test"
},
plugins: [
new webpack.DefinePlugin(BUILD_CONSTANTS)
]
},
node: {
mode: "production",
target: "node",
@ -400,7 +387,7 @@ module.exports = function (grunt) {
].join(";")
},
tests: {
command: "node --experimental-modules --no-warnings --no-deprecation test/index.mjs"
command: "node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs"
}
},
});

View File

@ -222,7 +222,7 @@ export default ${moduleName};
console.log(`\nNext steps:
1. Add your operation to ${colors.green("src/core/config/Categories.json")}
2. Write your operation code.
3. Write tests in ${colors.green("test/tests/operations/")}
3. Write tests in ${colors.green("tests/operations/tests/")}
4. Run ${colors.cyan("npm run lint")} and ${colors.cyan("npm run test")}
5. Submit a Pull Request to get your operation added to the official CyberChef repository.`);

View File

@ -8,7 +8,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import Chef from "../src/core/Chef";
import Chef from "../../src/core/Chef";
(function() {
/**

View File

@ -24,67 +24,67 @@ global.ENVIRONMENT_IS_WEB = function() {
};
import TestRegister from "./TestRegister";
import "./tests/operations/BCD";
import "./tests/operations/BSON";
import "./tests/operations/Base58";
import "./tests/operations/Base64";
import "./tests/operations/Base62";
import "./tests/operations/BitwiseOp";
import "./tests/operations/ByteRepr";
import "./tests/operations/CartesianProduct";
import "./tests/operations/CharEnc";
import "./tests/operations/Checksum";
import "./tests/operations/Ciphers";
import "./tests/operations/Code";
import "./tests/operations/Comment";
import "./tests/operations/Compress";
import "./tests/operations/ConditionalJump";
import "./tests/operations/Crypt";
import "./tests/operations/CSV";
import "./tests/operations/DateTime";
import "./tests/operations/ExtractEmailAddresses";
import "./tests/operations/Fork";
import "./tests/operations/FromDecimal";
import "./tests/operations/FromGeohash";
import "./tests/operations/Hash";
import "./tests/operations/HaversineDistance";
import "./tests/operations/Hexdump";
import "./tests/operations/Image";
import "./tests/operations/Jump";
import "./tests/operations/JSONBeautify";
import "./tests/operations/JSONMinify";
import "./tests/operations/JWTDecode";
import "./tests/operations/JWTSign";
import "./tests/operations/JWTVerify";
import "./tests/operations/MS";
import "./tests/operations/Magic";
import "./tests/operations/MorseCode";
import "./tests/operations/NetBIOS";
import "./tests/operations/OTP";
import "./tests/operations/PGP";
import "./tests/operations/PHP";
import "./tests/operations/ParseIPRange";
import "./tests/operations/ParseQRCode";
import "./tests/operations/PowerSet";
import "./tests/operations/Regex";
import "./tests/operations/Register";
import "./tests/operations/RemoveDiacritics";
import "./tests/operations/Rotate";
import "./tests/operations/SeqUtils";
import "./tests/operations/SetDifference";
import "./tests/operations/SetIntersection";
import "./tests/operations/SetUnion";
import "./tests/operations/StrUtils";
import "./tests/operations/SymmetricDifference";
import "./tests/operations/TextEncodingBruteForce";
import "./tests/operations/ToGeohash";
import "./tests/operations/TranslateDateTimeFormat";
import "./tests/operations/Magic";
import "./tests/operations/ParseTLV";
import "./tests/operations/Media";
import "./tests/BCD";
import "./tests/BSON";
import "./tests/Base58";
import "./tests/Base64";
import "./tests/Base62";
import "./tests/BitwiseOp";
import "./tests/ByteRepr";
import "./tests/CartesianProduct";
import "./tests/CharEnc";
import "./tests/Checksum";
import "./tests/Ciphers";
import "./tests/Code";
import "./tests/Comment";
import "./tests/Compress";
import "./tests/ConditionalJump";
import "./tests/Crypt";
import "./tests/CSV";
import "./tests/DateTime";
import "./tests/ExtractEmailAddresses";
import "./tests/Fork";
import "./tests/FromDecimal";
import "./tests/FromGeohash";
import "./tests/Hash";
import "./tests/HaversineDistance";
import "./tests/Hexdump";
import "./tests/Image";
import "./tests/Jump";
import "./tests/JSONBeautify";
import "./tests/JSONMinify";
import "./tests/JWTDecode";
import "./tests/JWTSign";
import "./tests/JWTVerify";
import "./tests/MS";
import "./tests/Magic";
import "./tests/MorseCode";
import "./tests/NetBIOS";
import "./tests/OTP";
import "./tests/PGP";
import "./tests/PHP";
import "./tests/ParseIPRange";
import "./tests/ParseQRCode";
import "./tests/PowerSet";
import "./tests/Regex";
import "./tests/Register";
import "./tests/RemoveDiacritics";
import "./tests/Rotate";
import "./tests/SeqUtils";
import "./tests/SetDifference";
import "./tests/SetIntersection";
import "./tests/SetUnion";
import "./tests/StrUtils";
import "./tests/SymmetricDifference";
import "./tests/TextEncodingBruteForce";
import "./tests/ToGeohash";
import "./tests/TranslateDateTimeFormat";
import "./tests/Magic";
import "./tests/ParseTLV";
import "./tests/Media";
// Cannot test operations that use the File type yet
//import "./tests/operations/SplitColourChannels";
//import "./tests/SplitColourChannels";
let allTestsPassing = true;
const testStatusCounts = {

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -7,7 +7,7 @@
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const EXAMPLE_CSV = `A,B,C,D,E,F\r
1,2,3,4,5,6\r

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const BASIC_STRING = "The ships hung in the sky in much the same way that bricks don't.";
const UTF8_STR = "ნუ პანიკას";

View File

@ -7,7 +7,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([

View File

@ -7,7 +7,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const JSON_TEST_DATA = {
"store": {

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
/**

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @licence Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",

View File

@ -7,7 +7,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const outputObject = JSON.stringify({
String: "SomeString",

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const inputObject = JSON.stringify({
String: "SomeString",

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const outputObject = JSON.stringify({
String: "SomeString",

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([

View File

@ -4,7 +4,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
const ASCII_TEXT = "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.";

View File

@ -7,7 +7,7 @@
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([

View File

@ -5,7 +5,7 @@
* @copyright Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -5,7 +5,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{

View File

@ -6,7 +6,7 @@
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../TestRegister";
import TestRegister from "../TestRegister";
TestRegister.addTests([
{