Skip to content
Snippets Groups Projects
Commit a6d5e63a authored by Gospodin Bodurov's avatar Gospodin Bodurov
Browse files

Fixes

parent 4ec3b7f3
No related branches found
No related tags found
1 merge request!6Implement pseudo plain parsing
......@@ -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", []));
});
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", "");
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment