mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 15:55:01 -04:00
working on test cases and dressing a bit of code
This commit is contained in:
parent
4fc37c4d02
commit
f7b8e51764
3 changed files with 25 additions and 1 deletions
|
@ -61,7 +61,7 @@ class ParseIMF extends Operation {
|
||||||
const dataObj = eml.extractData(fields);
|
const dataObj = eml.extractData(fields);
|
||||||
let subject = null;
|
let subject = null;
|
||||||
const retval = [];
|
const retval = [];
|
||||||
if (dataObj.length >= 1) {
|
if (dataObj.length) {
|
||||||
subject = dataObj[0].fields.subject;
|
subject = dataObj[0].fields.subject;
|
||||||
if (dataObj[0].header) {
|
if (dataObj[0].header) {
|
||||||
retval.push(new File([dataObj[0].header], "Header.txt", {type: "text/plain"}));
|
retval.push(new File([dataObj[0].header], "Header.txt", {type: "text/plain"}));
|
||||||
|
|
|
@ -75,6 +75,7 @@ import "./tests/operations/ToGeohash.mjs";
|
||||||
import "./tests/operations/TranslateDateTimeFormat";
|
import "./tests/operations/TranslateDateTimeFormat";
|
||||||
import "./tests/operations/Magic";
|
import "./tests/operations/Magic";
|
||||||
import "./tests/operations/ParseTLV";
|
import "./tests/operations/ParseTLV";
|
||||||
|
import "./tests/operations/Mime";
|
||||||
|
|
||||||
let allTestsPassing = true;
|
let allTestsPassing = true;
|
||||||
const testStatusCounts = {
|
const testStatusCounts = {
|
||||||
|
|
23
test/tests/operations/Mime.mjs
Normal file
23
test/tests/operations/Mime.mjs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/**
|
||||||
|
* Mime tests.
|
||||||
|
*
|
||||||
|
* @author bwhitn [brian.m.whitney@outlook.com]
|
||||||
|
* @copyright Crown Copyright 2018
|
||||||
|
* @license Apache-2.0
|
||||||
|
*/
|
||||||
|
import TestRegister from "../../TestRegister";
|
||||||
|
|
||||||
|
TestRegister.addTests([
|
||||||
|
{
|
||||||
|
name: "Decode Mime Encoded Words",
|
||||||
|
input: "This is a GBK base64 encoded word: =?GBK?B?x/izx7ncvta52NPazfjC59Pfx+nQxc+i16g=?=.\nThis is a Cyrillic quoted word: =?utf-8?Q?=D0=A2=D0=B5=D1=81=D1=82_=D0=A2=D0=B5=D1=81=D1=82_=D0=A2=D0=B5=D1=81=D1=82?=.",
|
||||||
|
expectedOutput: ["This is a GBK base64 encoded word: 区城管局关于网络舆情信息专.",
|
||||||
|
"This is a Cyrillic quoted word: Тест Тест Тест."].join("\n"),
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Decode Mime Encoded Words",
|
||||||
|
"args": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]);
|
Loading…
Add table
Add a link
Reference in a new issue