Skip to content
Snippets Groups Projects
Commit efc1a746 authored by Igor Markin's avatar Igor Markin
Browse files

Upgrades lib-mime, uses JSDOM instead of @vereign/dom

parent 9a587685
No related branches found
No related tags found
1 merge request!25Resolve "Upgrade light-utils and lib-mime"
Pipeline #42697 failed
import { JSDOM } from "jsdom";
const crypto = require("crypto");
import MIMEParser from "@vereign/mime-parser";
import MIMEParser from "@vereign/lib-mime";
import { expect, test } from "@jest/globals";
import { DOM } from "@vereign/dom";
import { PlainNormalizer, HTMLNormalizer } from "../../src";
import { listDirectories, readFile } from "./fileReader";
......@@ -207,11 +206,21 @@ const prepareTestCases = (
`${testsCasesPath}/${caseDir}/${RECEIVED_EML_NAME}`
);
const sentParsedMime = new MIMEParser(sentMimeString);
sentParsedMime.parseHTML = (htmlString: string) => {
return new JSDOM(htmlString).window.document;
};
const receivedParsedMime = new MIMEParser(receivedMimeString);
receivedParsedMime.parseHTML = (htmlString: string) => {
return new JSDOM(htmlString).window.document;
};
return [
caseDir,
{
sentMime: new MIMEParser(sentMimeString),
receivedMime: new MIMEParser(receivedMimeString),
sentMime: sentParsedMime,
receivedMime: receivedParsedMime,
},
];
});
......@@ -249,10 +258,7 @@ export const getDOMDocuments = async (
sentHtmlDocument: HTMLDocument;
receivedHtmlDocument: HTMLDocument;
}> => {
/**
* Usage of the @vereign/dom is a must, because of Google Add-on.
*/
const sentDOM = new DOM(
const sentDOM = new JSDOM(
await sentMime.getHTML({
populateAttachments: POPULATE_ATTACHMENTS,
hashAttachment,
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment