mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #35861 from overleaf/jel-email-notifications-domain-capture
[web] Use name in greeting for email notifications for domain capture GitOrigin-RevId: 56e46bc6de031656e4e8c0a9332f6b94aa517506
This commit is contained in:
@@ -1140,6 +1140,7 @@ describe('EmailBuilder', function () {
|
||||
expect(email.html).to.contain(
|
||||
'Domain capture is active for example.com'
|
||||
)
|
||||
expect(email.text).to.contain('Hi,')
|
||||
expect(email.html).to.contain('/manage/groups/group-123/settings')
|
||||
expect(email.text).to.contain('/manage/groups/group-123/settings')
|
||||
})
|
||||
@@ -1164,6 +1165,22 @@ describe('EmailBuilder', function () {
|
||||
expect(email.html).to.contain('admin@overleaf.test')
|
||||
expect(email.text).to.contain('admin@overleaf.test')
|
||||
})
|
||||
|
||||
it('should use firstName in greeting when provided', function (ctx) {
|
||||
const email = ctx.EmailBuilder.buildEmail(
|
||||
'groupDomainCapturedByGroupChanged',
|
||||
{
|
||||
to: 'admin@example.com',
|
||||
groupId: 'group-123',
|
||||
domainCapturedByGroup: true,
|
||||
domain: 'example.com',
|
||||
firstName: 'Ada',
|
||||
}
|
||||
)
|
||||
|
||||
expect(email.text).to.contain('Hi Ada,')
|
||||
expect(email.html).to.contain('Hi Ada,')
|
||||
})
|
||||
})
|
||||
|
||||
describe('domainVerifiedForGroup', function () {
|
||||
@@ -1175,6 +1192,7 @@ describe('EmailBuilder', function () {
|
||||
})
|
||||
|
||||
expect(email.subject).to.equal('Your domain is verified')
|
||||
expect(email.text).to.contain('Hi,')
|
||||
expect(email.html).to.contain("We've verified")
|
||||
expect(email.html).to.contain('<b>example.com</b>')
|
||||
expect(email.html).to.contain(
|
||||
@@ -1199,6 +1217,18 @@ describe('EmailBuilder', function () {
|
||||
"You'll receive a confirmation email once the capture is active."
|
||||
)
|
||||
})
|
||||
|
||||
it('should use firstName in greeting when provided', function (ctx) {
|
||||
const email = ctx.EmailBuilder.buildEmail('domainVerifiedForGroup', {
|
||||
to: 'admin@example.com',
|
||||
domain: 'example.com',
|
||||
capturedByGroup: true,
|
||||
firstName: 'Ada',
|
||||
})
|
||||
|
||||
expect(email.text).to.contain('Hi Ada,')
|
||||
expect(email.html).to.contain('Hi Ada,')
|
||||
})
|
||||
})
|
||||
|
||||
describe('domainReverificationFailed', function () {
|
||||
@@ -1244,6 +1274,23 @@ describe('EmailBuilder', function () {
|
||||
expect(ctx.email.html).to.contain(ctx.opts.domainSettingsUrl)
|
||||
expect(ctx.email.text).to.contain(ctx.opts.domainSettingsUrl)
|
||||
})
|
||||
|
||||
it('uses the default greeting when firstName is not provided', function (ctx) {
|
||||
expect(ctx.email.text).to.contain('Hi,')
|
||||
})
|
||||
|
||||
it('uses firstName in the greeting when provided', function (ctx) {
|
||||
const email = ctx.EmailBuilder.buildEmail(
|
||||
'domainReverificationFailed',
|
||||
{
|
||||
...ctx.opts,
|
||||
firstName: 'Ada',
|
||||
}
|
||||
)
|
||||
|
||||
expect(email.text).to.contain('Hi Ada,')
|
||||
expect(email.html).to.contain('Hi Ada,')
|
||||
})
|
||||
})
|
||||
|
||||
describe('when the domain is not captured by the group', function () {
|
||||
|
||||
@@ -43,3 +43,13 @@ describe('BackwardCompatibleError', function () {
|
||||
expect(error.cause).to.equal(cause)
|
||||
})
|
||||
})
|
||||
|
||||
describe('NotifyGroupAdminError', function () {
|
||||
it('is exported and can be constructed', function () {
|
||||
const error = new Errors.NotifyGroupAdminError('notify admin failed')
|
||||
|
||||
expect(error).to.be.instanceOf(Error)
|
||||
expect(error).to.be.instanceOf(Errors.NotifyGroupAdminError)
|
||||
expect(error.message).to.equal('notify admin failed')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user