Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async.eachSeries(files, (file, nextFile) => {
// We're only interested in email files.
if (file.substr(-4) !== ".eml")
return nextFile();
return async.series({
// Parse the EML file.
emailText: next => utils.parseEmlText(path.join(standardRepliesPath, file), next),
// Try and load the reply text for this message.
replyText: next => utils.tryReadFile(path.join(standardRepliesPath, file.slice(0, -4) + "_reply_text"), next),
// Compare the results.
checkText: (next, results) => {
// Try and extract the reply from the loaded message.
const extractedText = quotations.extractFromPlain(results.emailText).body;
// Compare the reply text and the extracted text.
assert.equal((results.replyText || "Hello").replace(/\r\n/g, "\n").trim(), extractedText);
return next();
}