fix(watcher): handle wrapped Subject lines in forwarded emails
Update the parseForwardedHeader function to correctly join wrapped Subject lines before the To: line, ensuring accurate parsing of Gmail forwarded messages. Enhance tests to validate this behavior with Tokopedia email examples.
This commit is contained in:
@@ -43,6 +43,16 @@ describe("parseForwardedHeader", () => {
|
||||
assert.equal(h.subject, "Pembayaran Berhasil!");
|
||||
});
|
||||
|
||||
it("joins wrapped Subject lines before To", () => {
|
||||
const h = parseForwardedHeader(tokopediaMultiForwardedBody);
|
||||
assert.ok(h);
|
||||
assert.match(h.from, /noreply@tokopedia\.com/);
|
||||
assert.equal(
|
||||
h.subject,
|
||||
"Pesanan Selesai: “sandal jepit ANDA pria casual...” dan 1 Item Lainnya",
|
||||
);
|
||||
});
|
||||
|
||||
it("returns null when there is no Fwd block", () => {
|
||||
assert.equal(parseForwardedHeader(livinDirectBody), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user