Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
feat(sms): Show SMS links in the mail helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Tomlinson committed May 30, 2017
1 parent f2a3d15 commit fd4b85a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/mail_helper.js
Expand Up @@ -45,6 +45,13 @@ module.exports = (printLogs) => {
var uc = mail.headers['x-unblock-code']
var vc = mail.headers['x-verify-code']
var template = mail.headers['x-template-name']

var smsLink
if (/MockNexmo\.message\.sendSms/.test(mail.subject)) {
const smsUrlMatch = /(https?:\/\/.*$)/.exec(mail.text)
smsLink = smsUrlMatch && smsUrlMatch[1]
}

var name = emailName(mail.headers.to)
if (vc) {
console.log('\x1B[32m', link, '\x1B[39m')
Expand All @@ -56,6 +63,9 @@ module.exports = (printLogs) => {
console.log('\x1B[36mUnblock code:', uc, '\x1B[39m')
console.log('\x1B[36mReport link:', rul, '\x1B[39m')
}
else if (smsLink) {
console.log('\x1B[36mSMS link:', smsLink, '\x1B[39m')
}
else if (TEMPLATES_WITH_NO_CODE.has(template)) {
console.log(`Notification email: ${template}`)
}
Expand Down

0 comments on commit fd4b85a

Please sign in to comment.