Autolinker = require 'autolinker' AutolinkerExtension = require '../lib/plugins/autolinker-extension' describe "AutolinkerExtension", -> beforeEach -> spyOn(Autolinker, 'link').andCallFake (txt) => txt it "should call through to Autolinker", -> AutolinkerExtension.formatMessageBody({body:'body'}) expect(Autolinker.link).toHaveBeenCalledWith('body', {twitter: false}) it "should add a title to everything with an href", -> message = body: """ hello world! hello world! hello world! hello world! """ expected = body: """ hello world! hello world! hello world! hello world! """ AutolinkerExtension.formatMessageBody(message) expect(message.body).toEqual(expected.body)