Skip to content

Commit 433adfb

Browse files
Merge pull request #338 from pointimize/fix
Fix function name in mail helper and fix the corresponding test
2 parents 9adc586 + 1dd7374 commit 433adfb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/helpers/mail/mail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ function MailSettings() {
387387
return this.bcc;
388388
};
389389

390-
this.setBypassListManagment = function(bypass_list_management) {
390+
this.setBypassListManagement = function(bypass_list_management) {
391391
this.bypass_list_management = bypass_list_management;
392392
};
393393

test/helpers/mail/test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,22 @@ describe('kitchenSink', function () {
114114

115115
mail.setBatchId("some_batch_id")
116116

117-
asm = new helper.ASM(3, [1,4,5])
118-
mail.setASM(asm)
117+
asm = new helper.Asm(3, [1,4,5])
118+
mail.setAsm(asm)
119119

120120
mail.setIpPoolName("23")
121121

122122
mail_settings = new helper.MailSettings()
123-
bcc = new helper.BCC(true, "[email protected]")
123+
bcc = new helper.Bcc(true, "[email protected]")
124124
mail_settings.setBcc(bcc)
125125
footer = new helper.Footer(true, "some footer text", "<html><body>some footer text</body></html>")
126126
mail_settings.setFooter(footer)
127127
sandbox_mode = new helper.SandBoxMode(true)
128128
mail_settings.setSandBoxMode(sandbox_mode)
129129
spam_check = new helper.SpamCheck(true, 1, "https://gotchya.example.com")
130130
mail_settings.setSpamCheck(spam_check)
131+
bypass_list_management = new helper.BypassListManagement(true);
132+
mail_settings.setBypassListManagement(bypass_list_management);
131133
mail.addMailSettings(mail_settings)
132134

133135
tracking_settings = new helper.TrackingSettings()
@@ -144,9 +146,9 @@ describe('kitchenSink', function () {
144146
email = new helper.Email("[email protected]", "Example User")
145147
mail.setReplyTo(email)
146148

147-
test_payload = '{"from":{"email":"[email protected]","name":"DX"},"personalizations":[{"to":[{"email":"[email protected]","name":"Example User"},{"email":"[email protected]","name":"Example User"}],"cc":[{"email":"[email protected]","name":"Example User"},{"email":"[email protected]","name":"Example User"}],"bcc":[{"email":"[email protected]","name":"Example User"},{"email":"[email protected]","name":"Example User"}],"subject":"Hello World from the Personalized SendGrid Node.js Library","headers":{"X-Test":"True","X-Test2":"False"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"timing":"morning","type":"marketing"},"send_at":1443636899}],"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>"},{"type":"text/calendar","value":"Party Time"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application/pdf","filename":"balance_001.pdf","disposition":"attachment"},{"content":"BwdW","type":"image/png","filename":"banner.png","disposition":"inline","content_id":"banner"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Textforasubstitutiontagofsection1","%section2%":"Textforasubstitutiontagofsection2"},"headers":{"X-Test3":"1","X-Test4":"2"},"categories":["January","2015"],"custom_args":{"timing":"evening","type":"summer_contest"},"send_at":1443636899,"batch_id":"some_batch_id","asm":{"group_id":3,"groups_to_display":[1,4,5]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"[email protected]"},"footer":{"enable":true,"text":"some footer text","html":"<html><body>some footer text</body></html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https://gotchya.example.com"}},"tracking_settings":{"click_tracking":{"enable":false,"enable_text":false},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text/plain portion of the message","html":"html to insert into the text/html portion of the message","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some utm source","utm_medium":"some utc medium","utm_term":"some utm term","utm_content":"some utm content","utm_campaign":"some utm campaign"}},"reply_to":{"email":"[email protected]","name":"DX"}}'
149+
test_payload = '{"from":{"email":"[email protected]","name":"Example User"},"personalizations":[{"to":[{"email":"[email protected]","name":"Example User"},{"email":"[email protected]","name":"Example User"}],"cc":[{"email":"[email protected]","name":"Example User"},{"email":"[email protected]","name":"Example User"}],"bcc":[{"email":"[email protected]","name":"Example User"},{"email":"[email protected]","name":"Example User"}],"subject":"Hello World from the Personalized SendGrid Node.js Library","headers":{"X-Test":"True","X-Test2":"False"},"substitutions":{"%name%":"Example User","%city%":"Denver"},"custom_args":{"timing":"morning","type":"marketing"},"send_at":1443636899}],"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>"},{"type":"text/calendar","value":"Party Time"}],"attachments":[{"content":"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12","type":"application/pdf","filename":"balance_001.pdf","disposition":"attachment"},{"content":"BwdW","type":"image/png","filename":"banner.png","disposition":"inline","content_id":"banner"}],"template_id":"439b6d66-4408-4ead-83de-5c83c2ee313a","sections":{"%section1%":"Textforasubstitutiontagofsection1","%section2%":"Textforasubstitutiontagofsection2"},"headers":{"X-Test3":"1","X-Test4":"2"},"categories":["January","2015"],"custom_args":{"timing":"evening","type":"summer_contest"},"send_at":1443636899,"batch_id":"some_batch_id","asm":{"group_id":3,"groups_to_display":[1,4,5]},"ip_pool_name":"23","mail_settings":{"bcc":{"enable":true,"email":"[email protected]"},"bypass_list_management":{"enable":true},"footer":{"enable":true,"text":"some footer text","html":"<html><body>some footer text</body></html>"},"sandbox_mode":{"enable":true},"spam_check":{"enable":true,"threshold":1,"post_to_url":"https://gotchya.example.com"}},"tracking_settings":{"click_tracking":{"enable":false,"enable_text":false},"open_tracking":{"enable":true,"substitution_tag":"Optional tag to replace with the open image in the body of the message"},"subscription_tracking":{"enable":true,"text":"text to insert into the text/plain portion of the message","html":"html to insert into the text/html portion of the message","substitution_tag":"Optional tag to replace with the open image in the body of the message"},"ganalytics":{"enable":true,"utm_source":"some utm source","utm_medium":"some utc medium","utm_term":"some utm term","utm_content":"some utm content","utm_campaign":"some utm campaign"}},"reply_to":{"email":"[email protected]","name":"Example User"}}'
148150

149151
it('builds the correct payload', function() {
150152
assert.equal(JSON.stringify(mail.toJSON()), test_payload, 'payload is correct')
151153
});
152-
})
154+
})

0 commit comments

Comments
 (0)