{Message} = require 'nylas-exports' SignatureDraftStoreExtension = require '../lib/draft-extension' describe "SignatureDraftStoreExtension", -> describe "prepareNewDraft", -> describe "when a signature is defined", -> beforeEach -> @signature = "
This is my signature.
" spyOn(atom.config, 'get').andCallFake => @signature it "should insert the signature at the end of the message or before the first blockquote", -> a = new Message draft: true body: 'This is a test!
Hello world
' b = new Message draft: true body: 'This is a another test.' SignatureDraftStoreExtension.prepareNewDraft(a) expect(a.body).toEqual("This is a test!
This is my signature.
Hello world
") SignatureDraftStoreExtension.prepareNewDraft(b) expect(b.body).toEqual("This is a another test
This is my signature.
") describe "when a signature is not defined", -> beforeEach -> spyOn(atom.config, 'get').andCallFake -> null it "should not do anything", -> a = new Message draft: true body: 'This is a test!
Hello world
' SignatureDraftStoreExtension.prepareNewDraft(a) expect(a.body).toEqual('This is a test!
Hello world
')