Skip to content

Commit 19b36ea

Browse files
Updating test to reflect Hello World Example
1 parent 9767ae6 commit 19b36ea

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

test/helpers/mail/test.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
var assert = require('chai').assert
22

3+
var helper = require('sendgrid').mail;
4+
35
// Test the minimum required to send an email
46
describe('helloEmail', function () {
57
var helper = require('../../../lib/helpers/mail/mail.js')
8+
var fromEmail = new helper.Email('[email protected]');
9+
var toEmail = new helper.Email('[email protected]');
10+
var subject = 'Sending with SendGrid is Fun';
11+
var content = new helper.Content('text/plain', 'and easy to do anywhere, even with Node.js');
12+
var mail = new helper.Mail(fromEmail, subject, toEmail, content);
613

7-
mail = new helper.Mail()
8-
email = new helper.Email("[email protected]")
9-
mail.setFrom(email)
10-
11-
personalization = new helper.Personalization()
12-
email = new helper.Email("[email protected]")
13-
personalization.addTo(email)
14-
mail.addPersonalization(personalization)
15-
16-
mail.setSubject("Hello World from the SendGrid Node.js Library")
17-
18-
content = new helper.Content("text/plain", "some text here")
19-
mail.addContent(content)
20-
content = new helper.Content("text/html", "<html><body>some text here</body></html>")
21-
mail.addContent(content)
22-
23-
test_payload = '{"from":{"email":"[email protected]"},"personalizations":[{"to":[{"email":"[email protected]"}]}],"subject":"Hello World from the SendGrid Node.js Library","content":[{"type":"text/plain","value":"some text here"},{"type":"text/html","value":"<html><body>some text here</body></html>"}]}'
14+
test_payload = '{"from":{"email":"[email protected]"},"personalizations":[{"to":[{"email":"[email protected]"}]}],"subject":"Sending with SendGrid is Fun","content":[{"type":"text/plain","value":"and easy to do anywhere, even with Node.js"}]}'
2415

2516
it('builds the correct payload', function() {
2617
assert.equal(JSON.stringify(mail.toJSON()), test_payload, 'payload is correct')

0 commit comments

Comments
 (0)