-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const { assert } = require('chai'); | ||
|
||
const MailService = require('./mail-service'); | ||
describe('MailService send', () => { | ||
it('should not mutate original data variable', () => { | ||
const mailService = new MailService(); | ||
mailService.setClient({ | ||
request: (req, cb) => { | ||
return new Promise((resolve) => { | ||
resolve(); | ||
}); | ||
}, | ||
}); | ||
const data = { | ||
to: '[email protected]', | ||
from: '[email protected]', // Use the email address or domain you verified above | ||
subject: 'Sending with Twilio SendGrid is Fun', | ||
text: 'and easy to do anywhere, even with Node.js', | ||
html: '<strong>and easy to do anywhere, even with Node.js</strong>', | ||
}; | ||
return mailService.send(data).then(() => { | ||
assert.deepStrictEqual(data, | ||
{ | ||
to: '[email protected]', | ||
from: '[email protected]', // Use the email address or domain you verified above | ||
subject: 'Sending with Twilio SendGrid is Fun', | ||
text: 'and easy to do anywhere, even with Node.js', | ||
html: '<strong>and easy to do anywhere, even with Node.js</strong>', | ||
}); | ||
|
||
}); | ||
}); | ||
}); |