Added parsing of headers.

This commit is contained in:
mshwed 2019-09-03 20:33:57 -04:00 committed by mshwed
parent c3994aa8e3
commit 7f97afd3e0
3 changed files with 172 additions and 78 deletions

View file

@ -0,0 +1,46 @@
/**
* MIME Header Decoding tests
*
* @author mshwed [m@ttshwed.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Encoded =?",
input: "=?=?utf-8?q?test?=",
expectedOutput: "=?test",
recipeConfig: [
{
"op": "MIME Decoding",
"args": []
}
]
},
{
name: "UTF-8 Encodings Multiple Headers",
input: "=?utf-8?q?=C3=89ric?= <eric@example.org>, =?utf-8?q?Ana=C3=AFs?= <anais@example.org>",
expectedOutput: "Éric <eric@example.org>, Anaïs <anais@example.org>",
recipeConfig: [
{
"op": "MIME Decoding",
"args": []
}
]
},
{
name: "UTF-8 Encodings Single Header",
input: "=?utf-8?q?=C2=A1Hola,?= =?utf-8?q?_se=C3=B1or!?=",
expectedOutput: "¡Hola, señor!",
recipeConfig: [
{
"op": "MIME Decoding",
"args": []
}
]
},
]);