EmailBuilderTests.coffee 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. should = require('chai').should()
  2. SandboxedModule = require('sandboxed-module')
  3. assert = require('assert')
  4. path = require('path')
  5. sinon = require('sinon')
  6. modulePath = path.join __dirname, "../../../../app/js/Features/Email/EmailBuilder"
  7. expect = require("chai").expect
  8. _ = require('underscore')
  9. _.templateSettings =
  10. interpolate: /\{\{(.+?)\}\}/g
  11. describe "EmailBuilder", ->
  12. beforeEach ->
  13. @settings = appName: "testApp"
  14. @EmailBuilder = SandboxedModule.require modulePath, requires:
  15. "settings-sharelatex":@settings
  16. "logger-sharelatex": log:->
  17. describe "projectInvite", ->
  18. beforeEach ->
  19. @opts =
  20. to:"bob@bob.com"
  21. first_name:"bob"
  22. owner:
  23. email:"sally@hally.com"
  24. inviteUrl: "http://example.com/invite"
  25. project:
  26. url:"http://www.project.com"
  27. name:"standard project"
  28. @email = @EmailBuilder.buildEmail("projectInvite", @opts)
  29. it 'should have html and text properties', ->
  30. expect(@email.html?).to.equal true
  31. expect(@email.text?).to.equal true
  32. it "should not have undefined in it", ->
  33. @email.html.indexOf("undefined").should.equal -1
  34. @email.subject.indexOf("undefined").should.equal -1