Fix, and link, Fernet tests (#2335)

This commit is contained in:
GCHQDeveloper581 2026-04-27 12:35:10 +01:00 committed by GitHub
parent ba09f5f1d5
commit 534032f4fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View File

@ -72,6 +72,7 @@ import "./tests/ExtractAudioMetadata.mjs";
import "./tests/ExtractEmailAddresses.mjs";
import "./tests/ExtractHashes.mjs";
import "./tests/ExtractIPAddresses.mjs";
import "./tests/Fernet.mjs";
import "./tests/Float.mjs";
import "./tests/FileTree.mjs";
import "./tests/FletcherChecksum.mjs";

View File

@ -5,7 +5,7 @@
* @copyright Karsten Silkenbäumer 2019
* @license Apache-2.0
*/
import TestRegister from "../TestRegister";
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
@ -47,7 +47,7 @@ TestRegister.addTests([
{
name: "Fernet Encrypt: no input",
input: "",
expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
expectedMatch: /^gAAA[\w-]+={0,2}$/,
recipeConfig: [
{
op: "Fernet Encrypt",
@ -69,12 +69,27 @@ TestRegister.addTests([
{
name: "Fernet Encrypt: valid arguments",
input: "This is a secret message.\n",
expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
expectedMatch: /^gAAA[\w-]+={0,2}$/,
recipeConfig: [
{
op: "Fernet Encrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
],
},
{
name: "Fernet Encrypt/Decrypt: round trip",
input: "This is a secret message.\n",
expectedOutput: "This is a secret message.\n",
recipeConfig: [
{
op: "Fernet Encrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
},
{
op: "Fernet Decrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
},
],
}
]);