mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 22:21:01 +01:00
Added some tests for the Translate DateTime Format operation
This commit is contained in:
parent
1a1fad7433
commit
f1c31ea966
@ -62,6 +62,7 @@ import "./tests/operations/SetDifference";
|
||||
import "./tests/operations/SetIntersection";
|
||||
import "./tests/operations/SetUnion";
|
||||
import "./tests/operations/SymmetricDifference";
|
||||
import "./tests/operations/TranslateDateTimeFormat";
|
||||
import "./tests/operations/Magic";
|
||||
|
||||
let allTestsPassing = true;
|
||||
|
56
test/tests/operations/TranslateDateTimeFormat.mjs
Normal file
56
test/tests/operations/TranslateDateTimeFormat.mjs
Normal file
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Translate DateTime Format tests.
|
||||
*
|
||||
* @author Cynser
|
||||
*
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../TestRegister";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Translate DateTime Format",
|
||||
input: "01/04/1999 22:33:01",
|
||||
expectedOutput: "Thursday 1st April 1999 22:33:01 +00:00 UTC",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Translate DateTime Format: invalid input",
|
||||
input: "1234567890",
|
||||
expectedMatch: /Invalid format./,
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Translate DateTime Format: timezone conversion",
|
||||
input: "01/04/1999 22:33:01",
|
||||
expectedOutput: "Thursday 1st April 1999 17:33:01 -05:00 EST",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Standard date and time", "DD/MM/YYYY HH:mm:ss", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "US/Eastern"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Translate DateTime Format: automatic input format",
|
||||
input: "1999-04-01 22:33:01",
|
||||
expectedOutput: "Thursday 1st April 1999 22:33:01 +00:00 UTC",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Translate DateTime Format",
|
||||
args: ["Automatic", "", "UTC", "dddd Do MMMM YYYY HH:mm:ss Z z", "UTC"],
|
||||
},
|
||||
],
|
||||
}
|
||||
]);
|
Loading…
Reference in New Issue
Block a user