|
@@ -142,6 +142,45 @@ describe('EmailBuilder', function() {
|
|
|
|
|
|
|
|
describe('templates', function() {
|
|
describe('templates', function() {
|
|
|
describe('CTA', function() {
|
|
describe('CTA', function() {
|
|
|
|
|
+ describe('confirmEmail', function() {
|
|
|
|
|
+ before(function() {
|
|
|
|
|
+ this.emailAddress = 'example@overleaf.com'
|
|
|
|
|
+ this.userId = 'abc123'
|
|
|
|
|
+ this.opts = {
|
|
|
|
|
+ to: this.emailAddress,
|
|
|
|
|
+ confirmEmailUrl: `${
|
|
|
|
|
+ this.settings.siteUrl
|
|
|
|
|
+ }/user/emails/confirm?token=aToken123`,
|
|
|
|
|
+ sendingUser_id: this.userId
|
|
|
|
|
+ }
|
|
|
|
|
+ this.email = this.EmailBuilder.buildEmail('confirmEmail', this.opts)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should build the email', function() {
|
|
|
|
|
+ expect(this.email.html).to.exist
|
|
|
|
|
+ expect(this.email.text).to.exist
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ describe('HTML email', function() {
|
|
|
|
|
+ it('should include a CTA button and a fallback CTA link', function() {
|
|
|
|
|
+ const dom = cheerio.load(this.email.html)
|
|
|
|
|
+ const buttonLink = dom('a:contains("Confirm Email")')
|
|
|
|
|
+ expect(buttonLink.length).to.equal(1)
|
|
|
|
|
+ expect(buttonLink.attr('href')).to.equal(this.opts.confirmEmailUrl)
|
|
|
|
|
+ const fallback = dom('.avoid-auto-linking').last()
|
|
|
|
|
+ expect(fallback.length).to.equal(1)
|
|
|
|
|
+ const fallbackLink = fallback.html()
|
|
|
|
|
+ expect(fallbackLink).to.contain(this.opts.confirmEmailUrl)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ describe('plain text email', function() {
|
|
|
|
|
+ it('should contain the CTA link', function() {
|
|
|
|
|
+ expect(this.email.text).to.contain(this.opts.confirmEmailUrl)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
describe('ownershipTransferConfirmationNewOwner', function() {
|
|
describe('ownershipTransferConfirmationNewOwner', function() {
|
|
|
before(function() {
|
|
before(function() {
|
|
|
this.emailAddress = 'example@overleaf.com'
|
|
this.emailAddress = 'example@overleaf.com'
|