summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTushar Bhushan <tushar.bhushan@yahoo.com>2015-10-07 15:11:16 -0700
committerTushar Bhushan <tushar.bhushan@yahoo.com>2015-10-07 15:11:16 -0700
commitce1e693d24c587047dfd775730245a62ead4b24d (patch)
treec0096a4adbb05f5a57b87f1b1b94b78a23914fdb
parent4eea56b1182c20bcf02508b76cea6875d438f301 (diff)
downloadsendgrid-nodejs-ce1e693d24c587047dfd775730245a62ead4b24d.zip
sendgrid-nodejs-ce1e693d24c587047dfd775730245a62ead4b24d.tar.gz
sendgrid-nodejs-ce1e693d24c587047dfd775730245a62ead4b24d.tar.bz2
modified/added tests for smtpapi methods
-rw-r--r--test/lib/email.test.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/lib/email.test.js b/test/lib/email.test.js
index a9ddd72..835cc04 100644
--- a/test/lib/email.test.js
+++ b/test/lib/email.test.js
@@ -119,13 +119,25 @@ describe('Email', function () {
var payload = Object.create(default_payload);
payload.to = "";
var email = new Email(payload);
- email.addTo("test@test.com");
+ email.addSmtpapiTo("test@test.com");
var format = email.toWebFormat();
- expect(JSON.parse(format['x-smtpapi']).to).to.not.be.empty;
expect(format.to).to.not.be.empty;
+ expect(JSON.parse(format['x-smtpapi']).to).to.not.be.empty;
});
+ it('should have to addresses if there is no tos set but there are smtpapi tos set', function() {
+ var payload = Object.create(default_payload);
+ payload.to = "";
+ var email = new Email(payload);
+ email.setSmtpapiTos(["test@test.com", "test2@test.com"]);
+ var format = email.toWebFormat();
+
+ expect(format.to).to.not.be.empty;
+ expect(JSON.parse(format['x-smtpapi']).to).to.not.be.empty;
+ expect(JSON.parse(format['x-smtpapi']).to).to.be.an.array;
+ })
+
it("should set a fromname if one is provided", function() {
var payload = Object.create(default_payload);
var email = new Email({from: 'test@test.com', fromname:'Tester T. Testerson', subject: 'testing', text: 'testing'});