-
Notifications
You must be signed in to change notification settings - Fork 779
Expand file tree
/
Copy pathmail-service.spec.js
More file actions
33 lines (31 loc) · 1.12 KB
/
mail-service.spec.js
File metadata and controls
33 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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: 'test@example.com',
from: 'test@example.com', // 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: 'test@example.com',
from: 'test@example.com', // 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>',
});
});
});
});