Mailspring/internal_packages/message-autoload-images/spec/autoload-images-extension-spec.es6
mbilker f13fc46611 lint(*): correct eslint errors, warnings still exist
There are warnings in `spellcheck-composer-extension.es6` for the `while (true)`
loops.
2016-03-01 10:58:29 -05:00

36 lines
1.1 KiB
JavaScript

import fs from 'fs';
import path from 'path';
import AutoloadImagesExtension from '../lib/autoload-images-extension';
import AutoloadImagesStore from '../lib/autoload-images-store';
describe("AutoloadImagesExtension", () => {
describe("formatMessageBody", () => {
const scenarios = [];
const fixtures = path.resolve(path.join(__dirname, 'fixtures'));
fs.readdirSync(fixtures).forEach((filename) => {
if (filename.endsWith('-in.html')) {
const name = filename.replace('-in.html', '');
scenarios.push({
name: name,
in: fs.readFileSync(path.join(fixtures, filename)).toString(),
out: fs.readFileSync(path.join(fixtures, `${name}-out.html`)).toString(),
});
}
});
scenarios.forEach((scenario)=> {
it(`should process ${scenario.name}`, () => {
spyOn(AutoloadImagesStore, 'shouldBlockImagesIn').andReturn(true);
const message = {
body: scenario.in,
};
AutoloadImagesExtension.formatMessageBody({message});
expect(message.body === scenario.out).toBe(true);
});
});
});
});