Preserve QOutlook priority headers in EML

This commit is contained in:
Курнат Андрей
2026-06-01 19:59:53 +03:00
parent 9bd8827549
commit 15ea571395
5 changed files with 65 additions and 2 deletions
+24
View File
@@ -180,6 +180,9 @@ describe("outlookMail helpers", () => {
"Message-ID: <message-1@example.com>",
"In-Reply-To: <parent@example.com>",
"References: <root@example.com> <parent@example.com>",
"Importance: high",
"X-Priority: 1",
"Priority: urgent",
"Subject: =?UTF-8?B?0JzRg9C70YzRgtC40L/QsNGA0YI=?=",
"Date: Mon, 01 Jun 2026 10:00:00 +0300",
'Content-Type: multipart/alternative; boundary="alt"',
@@ -208,6 +211,9 @@ describe("outlookMail helpers", () => {
expect(imported.messageId).toBe("<message-1@example.com>");
expect(imported.inReplyTo).toBe("<parent@example.com>");
expect(imported.references).toBe("<root@example.com> <parent@example.com>");
expect(imported.importance).toBe("high");
expect(imported.xPriority).toBe("1");
expect(imported.priority).toBe("urgent");
});
it("импортирует multipart/mixed EML с вложением", async () => {
@@ -262,6 +268,9 @@ describe("outlookMail helpers", () => {
"Message-ID: <msg-1@example.com>",
"In-Reply-To: <msg-parent@example.com>",
"References: <msg-root@example.com> <msg-parent@example.com>",
"Importance: low",
"X-Priority: 5",
"Priority: non-urgent",
"From: sender@example.com"
].join("\r\n"),
bodyHtml: "<p>HTML&nbsp;текст</p>",
@@ -285,6 +294,9 @@ describe("outlookMail helpers", () => {
messageId: "<msg-1@example.com>",
inReplyTo: "<msg-parent@example.com>",
references: "<msg-root@example.com> <msg-parent@example.com>",
importance: "low",
xPriority: "5",
priority: "non-urgent",
subject: "MSG отчет",
body: "HTML текст",
time: "Mon, 01 Jun 2026 10:00:00 GMT",
@@ -317,6 +329,9 @@ describe("outlookMail helpers", () => {
messageId: "<message-1@example.com>",
inReplyTo: "<parent@example.com>",
references: "<root@example.com> <parent@example.com>",
importance: "high",
xPriority: "1",
priority: "urgent",
subject: "Тема",
body: "Текст",
time: "Mon, 01 Jan 2024 10:00:00 +0000",
@@ -333,6 +348,9 @@ describe("outlookMail helpers", () => {
expect(eml).toContain("Message-ID: <message-1@example.com>");
expect(eml).toContain("In-Reply-To: <parent@example.com>");
expect(eml).toContain("References: <root@example.com> <parent@example.com>");
expect(eml).toContain("Importance: high");
expect(eml).toContain("X-Priority: 1");
expect(eml).toContain("Priority: urgent");
expect(eml).toContain("Subject: =?UTF-8?B?");
expect(eml.endsWith("Текст")).toBe(true);
});
@@ -349,6 +367,9 @@ describe("outlookMail helpers", () => {
messageId: "<message-1@example.com>",
inReplyTo: "<parent@example.com>",
references: "<root@example.com> <parent@example.com>",
importance: "high",
xPriority: "1",
priority: "urgent",
subject: "Тема",
body: "Текст",
time: "Mon, 01 Jan 2024 10:00:00 +0000",
@@ -377,6 +398,9 @@ describe("outlookMail helpers", () => {
expect(eml).toContain("Message-ID: <message-1@example.com>");
expect(eml).toContain("In-Reply-To: <parent@example.com>");
expect(eml).toContain("References: <root@example.com> <parent@example.com>");
expect(eml).toContain("Importance: high");
expect(eml).toContain("X-Priority: 1");
expect(eml).toContain("Priority: urgent");
expect(eml).toContain("filename*=utf-8''%D0%BE%D1%82%D1%87%D0%B5%D1%82%2E%74%78%74");
expect(extractMessageBody(parsed.headers, parsed.body)).toBe("Текст");
expect(attachments[0]).toMatchObject({