Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const assertMd = async (md, html, secrets = {}) => {
const fromHTML = (context) => {
context.response = {
status: 201,
body: context.content.document.body.innerHTML,
};
};
const generated = await pipe(
fromHTML,
{ content: { body: multiline(md) }, request: crequest },
{
logger,
request: { params },
secrets,
},
);
// check equality of the dom, but throw assertion based on strings to visualize difference.
const act = new JSDOM(generated.response.body);
const exp = new JSDOM(html);
assertEquivalentNode(act.window.document.body, exp.window.document.body);
};
const procMd = (md) => {
const dat = { content: { body: multiline(md) } };
parseMd(dat, { logger });
const orig = cloneDeep(dat.content.mdast);
parseFront(dat, { logger });
return { orig, proc: dat.content.mdast };
};