summaryrefslogtreecommitdiffstats
path: root/test/lib/email.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/email.test.js')
-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'});