import {Message} from 'nylas-exports'; import SignatureComposerExtension from '../lib/signature-composer-extension'; import SignatureStore from '../lib/signature-store'; describe("SignatureComposerExtension", ()=> { describe("prepareNewDraft", ()=> { describe("when a signature is defined", ()=> { beforeEach(()=> { this.signature = '
Hello world', }); const b = new Message({ draft: true, accountId: TEST_ACCOUNT_ID, body: 'This is a another test.', }); SignatureComposerExtension.prepareNewDraft({draft: a}); expect(a.body).toEqual('This is a test!
Hello world'); SignatureComposerExtension.prepareNewDraft({draft: b}); expect(b.body).toEqual('This is a another test.
Hello world', expected: `This is a test!
Hello world`, }, { // Populated signature div body: 'This is a test!
Hello world', }); SignatureComposerExtension.prepareNewDraft({draft: a}); expect(a.body).toEqual(`This is a test!
Hello world`); }); }); describe("when a blank signature is present in the config file", ()=> { beforeEach(()=> { spyOn(NylasEnv.config, 'get').andCallFake(()=> ""); }); it("should insert nothing", ()=> { const a = new Message({ draft: true, accountId: TEST_ACCOUNT_ID, body: 'This is a test!
Hello world', }); SignatureComposerExtension.prepareNewDraft({draft: a}); expect(a.body).toEqual(`This is a test!
Hello world`); }); }); }); });