From a6d5e63aa94fcbb53266986a9269ba2a73a6f65c Mon Sep 17 00:00:00 2001
From: Gospodin Bodurov <gospodin@bodurov.net>
Date: Thu, 3 Dec 2020 15:59:51 +0200
Subject: [PATCH] Fixes

---
 __tests__/pseudoplain-outlook-outlook.test.ts | 60 +++++--------------
 src/PlainNormalizer/PlainNormalizer.ts        |  9 +++
 2 files changed, 25 insertions(+), 44 deletions(-)

diff --git a/__tests__/pseudoplain-outlook-outlook.test.ts b/__tests__/pseudoplain-outlook-outlook.test.ts
index ba9df16..700201f 100644
--- a/__tests__/pseudoplain-outlook-outlook.test.ts
+++ b/__tests__/pseudoplain-outlook-outlook.test.ts
@@ -41,7 +41,12 @@ const createDescribePseudoPlainTestCases = (testsPath: string) =>
         testCasePath
       );
 
-      var normalizedReceivedPseudoPlainText = PlainNormalizer.normalizePlain(amendOutlookNodes(receivedHtmlDocument.body.textContent));
+      amendOutlookNodes(receivedHtmlDocument);
+      amendOutlookNodes(sentHtmlDocument);
+
+      //console.log(sentHtmlDocument.body.textContent);
+
+      var normalizedReceivedPseudoPlainText = PlainNormalizer.normalizePlain(receivedHtmlDocument.body.textContent);
       var normalizedSentPseudoPlainText = PlainNormalizer.normalizePlain(sentHtmlDocument.body.textContent);
 
       const difference = diffStringsUnified(
@@ -57,47 +62,14 @@ describe("[Pseudo PLAIN] Outlook-Outlook normalization", () => {
   const describeFunction = createDescribePseudoPlainTestCases(testsPath);
 
   // ["01"] - is a filter. Pass here names of directories with test cases you want to check
-  describe("Emails Chrome", describeFunction("chrome", null, []));
-
-  // describe(
-  //   "Emails Edge",
-  //   describeFunction("edge", [
-  //     "21", // This case has a src mismatch for the same image. Reproduce this case again
-  //     "08", // Files are missing for test case
-  //     "10", // Files are missing for test case
-  //   ])
-  // );
-  // describe(
-  //   "Emails Safari",
-  //   describeFunction("safari", [
-  //     "04", // This case contains <section> tag which is ignored by Outlook, and it also inserts a plenty of empty divs,
-  //     "08",
-  //   ])
-  // );
-
-  // Does not work at all
-  // describe(
-  //   "Emails MacOS",
-  //   describeFunction("macos", ["20", "21", "", "23", "24", "25", "26"])
-  // );
-
-  // describe(
-  //   "Emails Windows",
-  //   describeFunction("windows", [
-  //     "06",
-  //     "20",
-  //     "20forward",
-  //     "20reply",
-  //     "21",
-  //     "21forward",
-  //     "21reply",
-  //     "22",
-  //     "23",
-  //     "24",
-  //     "25",
-  //     "26",
-  //     "28",
-  //     "10", // missing files
-  //   ])
-  // );
+  //describe("Emails Chrome", describeFunction("chrome", null, []));
+
+  //describe("Emails Edge", describeFunction("edge", []));
+   
+  //describe("Emails Safari", describeFunction("safari", ["08"]));
+
+  //Does not work at all
+  describe("Emails MacOS", describeFunction("macos", []));
+
+  //describe("Emails Windows", describeFunction("windows", []));
 });
diff --git a/src/PlainNormalizer/PlainNormalizer.ts b/src/PlainNormalizer/PlainNormalizer.ts
index dc4cd68..9154652 100644
--- a/src/PlainNormalizer/PlainNormalizer.ts
+++ b/src/PlainNormalizer/PlainNormalizer.ts
@@ -1,6 +1,7 @@
 import { removeSpacesAndLinebreaks } from "../utils";
 
 export const normalizePlainPart = (text: string): string => {
+  text = removeListBullets(text);
   text = removeSpacesAndLinebreaks(text);
   return removeQRCodes(text);
 };
@@ -10,3 +11,11 @@ const removeQRCodes = (s: string): string => {
     .replace(/\[qrcode.png]\s*<https:\/\/[\w./?=\-&]+>/g, "")
     .replace(/<https:\/\/[\w./?=\-&]+>\s*\[qrcode.png]/g, "");
 };
+
+const removeListBullets = (s: string): string => {
+  return s
+    .replace("\no\n/g", "")
+    .replace("\n§\n/g", "")
+    .replace("\no /g", "")
+    .replace("\n§ /g", "");
+};
-- 
GitLab