TrackingPixelsExtension = require '../lib/plugins/tracking-pixels-extension' {Message} = require 'nylas-exports' testBody = """

Hey Ben,

I've noticed that we don't yet have an SLA in place with Nylas. Are you the right person to be speaking with to make sure everything is set up on that end? If not, could you please put me in touch with them, so that we can get you guys set up correctly as soon as possible?

Thanks!

Gleb Polyakov

Head of Business Development and Growth

After Pixel """ testBodyProcessed = """

Hey Ben,

I've noticed that we don't yet have an SLA in place with Nylas. Are you the right person to be speaking with to make sure everything is set up on that end? If not, could you please put me in touch with them, so that we can get you guys set up correctly as soon as possible?

Thanks!

Gleb Polyakov

Head of Business Development and Growth

After Pixel """ describe "TrackingPixelsExtension", -> it "should splice tracking pixels and only run on messages by the current user", -> message = new Message(body: testBody) spyOn(message, 'isFromMe').andCallFake -> false TrackingPixelsExtension.formatMessageBody(message) expect(message.body).toEqual(testBody) message = new Message(body: testBody) spyOn(message, 'isFromMe').andCallFake -> true TrackingPixelsExtension.formatMessageBody(message) expect(message.body).toEqual(testBodyProcessed)