Mailspring/internal_packages/remove-tracking-pixels/spec/tracking-pixels-extension-spec.es6

36 lines
1 KiB
Text
Raw Normal View History

/* eslint no-irregular-whitespace: 0 */
import {removeTrackingPixels} from '../lib/main';
import fs from 'fs';
const readFixture = (name) => {
return fs.readFileSync(`${__dirname}/fixtures/${name}`).toString().trim()
}
describe("TrackingPixelsExtension", function trackingPixelsExtension() {
it("should splice all tracking pixels from emails I've sent", () => {
const before = readFixture('a-before.txt');
const expected = readFixture('a-after.txt');
const message = {
body: before,
accountId: '1234',
isFromMe: () => true,
}
removeTrackingPixels(message);
expect(message.body).toEqual(expected);
});
it("should always splice Nylas read receipts for the current account id ", () => {
const before = readFixture('b-before.txt');
const expected = readFixture('b-after.txt');
const message = {
body: before,
accountId: '1234',
isFromMe: () => false,
}
removeTrackingPixels(message);
expect(message.body).toEqual(expected);
});
});