diff options
Diffstat (limited to 'test/lib/email.test.js')
-rw-r--r-- | test/lib/email.test.js | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/test/lib/email.test.js b/test/lib/email.test.js index 8a659c4..9ecf3c1 100644 --- a/test/lib/email.test.js +++ b/test/lib/email.test.js @@ -221,7 +221,20 @@ describe('Email', function () { expect(mail.headers).to.eql(custom_headers); }); - it('should allow setting custom headers one at a time with addHeader', function() { + it('should allow setting custom headers with key, value approach', function() { + mail.addHeader('fox', 'hound'); + expect(mail.headers.fox).to.eql('hound'); + }); + + it('should overwrite headers when calling addHeader with the same value', function() { + mail.addHeader(custom_headers); + expect(mail.headers).to.eql(custom_headers); + mail.addHeader('cow', 'in my mind'); + expect(mail.headers).not.to.eql(custom_headers); + expect(mail.headers.cow).to.eql('in my mind'); + }); + + it('should allow setting custom headers one at a time with addHeader as a hash (temporary. deprecate this ability for key, value approach instead)', function() { for(var key in custom_headers) { var args = {}; args[key] = custom_headers[key]; @@ -233,14 +246,6 @@ describe('Email', function () { expect(mail.headers.fox).to.eql('hound'); }); - it('should overwrite headers when calling addHeader with the same value', function() { - mail.addHeader(custom_headers); - expect(mail.headers).to.eql(custom_headers); - mail.addHeader({cow: 'in my mind'}); - expect(mail.headers).not.to.eql(custom_headers); - expect(mail.headers.cow).to.eql('in my mind'); - }); - }); describe('file handling the constructor', function() { |