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.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lib/email.test.js b/test/lib/email.test.js
index 20f99ca..549ad61 100644
--- a/test/lib/email.test.js
+++ b/test/lib/email.test.js
@@ -134,6 +134,18 @@ describe('Email', function () {
expect(format.fromname).to.equal('Tester T. Testerson');
});
+ it("should set a date 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', date: 'Wed, 17 Dec 2014 19:21:16 +0000'});
+ var format = email.toWebFormat();
+
+ expect(format.date).to.equal('Wed, 17 Dec 2014 19:21:16 +0000');
+
+ email.setDate('Wed, 17 Dec 2013 19:21:16 +0000');
+ format = email.toWebFormat();
+ expect(format.date).to.equal('Wed, 17 Dec 2013 19:21:16 +0000');
+ });
+
it("should set a toname if one is provided", function() {
var payload = Object.create(default_payload);
var email = new Email({from: 'test@test.com', to:'test@test.com', toname:'Tester T. Testerson', subject: 'testing', text: 'testing'});
@@ -189,6 +201,13 @@ describe('Email', function () {
expect(email.smtpapi.header.unique_args).to.eql({unique_arg1: 'value', unique_arg2: 'value'});
});
+ it('should be possible to setDate', function() {
+ var email = new Email();
+ expect(email.date).to.be.empty;
+ email.setDate('Wed, 17 Dec 2014 19:21:16 +0000');
+ expect(email.date).to.eql('Wed, 17 Dec 2014 19:21:16 +0000');
+ });
+
it('should be possible to setSendAt', function() {
var email = new Email();
expect(email.smtpapi.header.send_at).to.be.empty;