mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-23 00:06:17 -04:00
Initial work on in-browser test runner
Run `grunt test` and open up the `build/test/index.html` to run the tests.
This commit is contained in:
parent
92bd2c921e
commit
500522bdeb
9 changed files with 535 additions and 9 deletions
84
src/js/test/tests/core.js
Normal file
84
src/js/test/tests/core.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* Core tests.
|
||||
*
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*
|
||||
*/
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Example error",
|
||||
input: "1\n2\na\n4",
|
||||
expectedOutput: "1\n2\n3\n4",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", false],
|
||||
},
|
||||
{
|
||||
op: "To Base",
|
||||
args: [16],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Example fail",
|
||||
input: "1\n2\na\n4",
|
||||
expectedOutput: "1\n2\n3\n4",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", true],
|
||||
},
|
||||
{
|
||||
op: "To Base",
|
||||
args: [16],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, Merge: nothing",
|
||||
input: "",
|
||||
expectedOutput: "",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", false],
|
||||
},
|
||||
{
|
||||
op: "Merge",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fork, (expect) Error, Merge",
|
||||
input: "1\n2\na\n4",
|
||||
expectedError: true,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Fork",
|
||||
args: ["\n", "\n", false],
|
||||
},
|
||||
{
|
||||
op: "To Base",
|
||||
args: [16],
|
||||
},
|
||||
{
|
||||
op: "Merge",
|
||||
args: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue