Compare commits

...

2 Commits

Author SHA1 Message Date
Isaac Shoebottom
ee767d8067 Make body function work with all tests 2022-10-21 00:31:35 -03:00
Isaac Shoebottom
29d579b8ac Add extra test 2022-10-21 00:31:21 -03:00
2 changed files with 14 additions and 7 deletions

View File

@ -8,6 +8,7 @@ function match(message, headers) {
} }
function body(message) { function body(message) {
if (message["body"] !== undefined) {
if (message["body"][0]["content-type"] === "text/plain") { if (message["body"][0]["content-type"] === "text/plain") {
return message["body"][0]["content"]; return message["body"][0]["content"];
} }
@ -16,6 +17,8 @@ function body(message) {
return message["body"][0]["content"][0]["content"]; return message["body"][0]["content"][0]["content"];
} }
} }
return undefined;
}
function string(message) { function string(message) {
let string = ""; let string = "";

View File

@ -51,6 +51,10 @@ ciao,
Marco Marco
`); `);
}); });
it("no body",
function() {
expect(message.body(testMsg)).toEqual(undefined)
});
}); });
let fullHeaderMsg ={"headers": { let fullHeaderMsg ={"headers": {