mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-14 10:06:58 -04:00
Add tests for URLDecode and URLEncode
This commit is contained in:
parent
95d5fd1789
commit
3a55b34214
2 changed files with 93 additions and 0 deletions
|
@ -163,6 +163,7 @@ import "./tests/TranslateDateTimeFormat.mjs";
|
||||||
import "./tests/Typex.mjs";
|
import "./tests/Typex.mjs";
|
||||||
import "./tests/UnescapeString.mjs";
|
import "./tests/UnescapeString.mjs";
|
||||||
import "./tests/Unicode.mjs";
|
import "./tests/Unicode.mjs";
|
||||||
|
import "./tests/URLEncodeDecode.mjs";
|
||||||
import "./tests/RSA.mjs";
|
import "./tests/RSA.mjs";
|
||||||
import "./tests/CBOREncode.mjs";
|
import "./tests/CBOREncode.mjs";
|
||||||
import "./tests/CBORDecode.mjs";
|
import "./tests/CBORDecode.mjs";
|
||||||
|
|
92
tests/operations/tests/URLEncodeDecode.mjs
Normal file
92
tests/operations/tests/URLEncodeDecode.mjs
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
/**
|
||||||
|
* URLEncode and URLDecode tests.
|
||||||
|
*
|
||||||
|
* @author es45411 [135977478+es45411@users.noreply.github.com]
|
||||||
|
*
|
||||||
|
* @copyright Crown Copyright 2018
|
||||||
|
* @license Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
import TestRegister from "../../lib/TestRegister.mjs";
|
||||||
|
|
||||||
|
TestRegister.addTests([
|
||||||
|
// URL Decode
|
||||||
|
{
|
||||||
|
name: "URLDecode: nothing",
|
||||||
|
input: "",
|
||||||
|
expectedOutput: "",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Decode",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "URLDecode: spaces without special chars",
|
||||||
|
input: "Hello%20world%21",
|
||||||
|
expectedOutput: "Hello world!",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Decode",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "URLDecode: spaces with special chars",
|
||||||
|
input: "Hello%20world!",
|
||||||
|
expectedOutput: "Hello world!",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Decode",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "URLDecode: decode plus as space",
|
||||||
|
input: "Hello%20world!",
|
||||||
|
expectedOutput: "Hello world!",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Decode",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// URL Encode
|
||||||
|
{
|
||||||
|
name: "URLEncode: nothing",
|
||||||
|
input: "",
|
||||||
|
expectedOutput: "",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Encode",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "URLEncode: spaces without special chars",
|
||||||
|
input: "Hello world!",
|
||||||
|
expectedOutput: "Hello%20world!",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Encode",
|
||||||
|
args: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "URLEncode: spaces with special chars",
|
||||||
|
input: "Hello world!",
|
||||||
|
expectedOutput: "Hello%20world%21",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "URL Encode",
|
||||||
|
args: [true],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
Loading…
Add table
Add a link
Reference in a new issue