summaryrefslogtreecommitdiff
path: root/web-ui/test
diff options
context:
space:
mode:
authorAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-12-03 16:04:54 -0200
committerAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-12-03 16:04:54 -0200
commit7594b311441ca0c0eee39b4e953c52645213ffc3 (patch)
treef3e0f5640abf68027172795ca9ffd054d3d5db53 /web-ui/test
parentf7472aed29c525bc630fe1ea05833f840bc42dc4 (diff)
parentfada5155d78336ea4796e934520636472df17348 (diff)
Merge pull request #166 from pixelated-project/fix_reply_to_all_recipients
Fix reply to all recipients
Diffstat (limited to 'web-ui/test')
-rw-r--r--web-ui/test/spec/services/model/mail.spec.js37
-rw-r--r--web-ui/test/test_data.js74
2 files changed, 71 insertions, 40 deletions
diff --git a/web-ui/test/spec/services/model/mail.spec.js b/web-ui/test/spec/services/model/mail.spec.js
index 24a8d244..2cbd21e9 100644
--- a/web-ui/test/spec/services/model/mail.spec.js
+++ b/web-ui/test/spec/services/model/mail.spec.js
@@ -2,31 +2,17 @@
require(['services/model/mail'], function (Mail) {
'use strict';
- var testData;
describe('services/model/mail', function () {
- describe('reply addresses', function () {
- it('returns the "to" and "cc" addresses if the mail was sent', function () {
- var mail = Mail.create({
- header: { to: ['a@b.c', 'e@f.g'], cc: ['x@x.x'] },
- tags: [],
- mailbox: 'SENT'
- });
-
- var addresses = mail.replyToAddress();
-
- expect(addresses).toEqual({ to: ['a@b.c', 'e@f.g'], cc: ['x@x.x']});
- });
- });
-
describe('parsing', function () {
describe('a single email', function () {
- var sentMail, draftMail, recievedMail, recievedMailWithCC;
+ var sentMail, draftMail, recievedMail, recievedMailWithCC, rawMailWithMultipleTo;
beforeEach(function () {
sentMail = Mail.create(Pixelated.testData().rawMail.sent);
draftMail = Mail.create(Pixelated.testData().rawMail.draft);
recievedMail = Mail.create(Pixelated.testData().rawMail.recieved);
recievedMailWithCC = Mail.create(Pixelated.testData().rawMail.recievedWithCC);
+ rawMailWithMultipleTo = Mail.create(Pixelated.testData().rawMail.rawMailWithMultipleTo);
});
it('correctly identifies a sent mail', function () {
@@ -41,25 +27,6 @@ require(['services/model/mail'], function (Mail) {
expect(recievedMail.isSentMail()).toBe(false);
expect(recievedMail.isDraftMail()).toBe(false);
});
-
- it('reply to of a sent mail should be original recipient', function () {
- expect(sentMail.replyToAddress()).toEqual({to: ['mariane_dach@davis.info'], cc: ['duda@la.lu']});
- });
-
- it('reply to of a mail should be the reply_to field if existent', function () {
- expect(recievedMail.replyToAddress()).toEqual({to: ['afton_braun@botsford.biz'], cc: [] });
- });
-
- it('reply to of a mail should be the from field if no reply_to present', function () {
- expect(recievedMailWithCC.replyToAddress()).toEqual({to: ['cleve_jaskolski@schimmelhirthe.net'], cc: []});
- });
-
- it('reply to all should include all email addresses in the header', function () {
- expect(recievedMailWithCC.replyToAllAddress()).toEqual({
- to: ['cleve_jaskolski@schimmelhirthe.net', 'stanford@sipes.com'],
- cc: ['mariane_dach@davis.info']
- });
- });
});
describe('multipart email', function () {
diff --git a/web-ui/test/test_data.js b/web-ui/test/test_data.js
index 194cd02d..018c3143 100644
--- a/web-ui/test/test_data.js
+++ b/web-ui/test/test_data.js
@@ -16,6 +16,13 @@ define(function() {
security_casing: {
locks: [],
imprints: []
+ },
+ replying: {
+ single: 'laurel@hamil.info',
+ all: {
+ 'to-field': ['laurel@hamil.info'],
+ 'cc-field': []
+ }
}
};
@@ -25,7 +32,15 @@ define(function() {
'tags':['photography','sky'],
'status':['read'],
'body':'Illum eos nihil commodi voluptas. Velit consequatur odio quibusdam. Beatae aliquam hic quos.',
- 'mailbox': 'SENT'
+ 'mailbox': 'SENT',
+ replying: {
+ single: 'laurel@hamil.info',
+ all: {
+ 'to-field': ['mariane_dach@davis.info'],
+ 'cc-field': ['duda@la.lu']
+ }
+ }
+
};
var rawDraftMail = {
@@ -34,7 +49,15 @@ define(function() {
'tags':['photography','sky'],
'status':['read'],
'body':'Illum eos nihil commodi voluptas. Velit consequatur odio quibusdam. Beatae aliquam hic quos.',
- 'mailbox': 'DRAFTS'
+ 'mailbox': 'DRAFTS',
+ replying: {
+ single: 'afton_braun@botsford.biz',
+ all: {
+ 'to-field': ['afton_braun@botsford.biz'],
+ 'cc-field': []
+ }
+ }
+
};
var rawRecievedMail = {
@@ -42,7 +65,15 @@ define(function() {
'ident':242,
'tags':['garden','instalovers','popularpic'],
'status':['read'],
- 'body':'Sed est neque tempore. Alias officiis pariatur ullam porro corporis. Tempore eum quia placeat. Sapiente fuga cum.'
+ 'body':'Sed est neque tempore. Alias officiis pariatur ullam porro corporis. Tempore eum quia placeat. Sapiente fuga cum.',
+ replying: {
+ single: 'afton_braun@botsford.biz',
+ all: {
+ 'to-field': ['cleve_jaskolski@schimmelhirthe.net', 'afton_braun@botsford.biz'],
+ 'cc-field': []
+ }
+ }
+
};
var rawRecievedWithCCMail = {
@@ -50,7 +81,31 @@ define(function() {
'ident':242,
'tags':['garden','instalovers','popularpic'],
'status':['read'],
- 'body':'Sed est neque tempore. Alias officiis pariatur ullam porro corporis. Tempore eum quia placeat. Sapiente fuga cum.'
+ 'body':'Sed est neque tempore. Alias officiis pariatur ullam porro corporis. Tempore eum quia placeat. Sapiente fuga cum.',
+ replying: {
+ single: 'cleve_jaskolski@schimmelhirthe.net',
+ all: {
+ 'to-field': ['cleve_jaskolski@schimmelhirthe.net'],
+ 'cc-field': ['mariane_dach@davis.info']
+ }
+ }
+
+ };
+
+ var rawMailWithMultipleTo = {
+ 'header':{'to':['stanford@sipes.com', 'someoneelse@some-other-domain.tld'],'from':'cleve_jaskolski@schimmelhirthe.net','cc':'mariane_dach@davis.info','subject':'Cumque pariatur vel consequuntur deleniti ex.','date':'2014-06-17T05:40:29-03:00'},
+ 'ident':242,
+ 'tags':['garden','instalovers','popularpic'],
+ 'status':['read'],
+ 'body':'Sed est neque tempore. Alias officiis pariatur ullam porro corporis. Tempore eum quia placeat. Sapiente fuga cum.',
+ replying: {
+ single: 'cleve_jaskolski@schimmelhirthe.net',
+ all: {
+ 'to-field': ['cleve_jaskolski@schimmelhirthe.net', 'someoneelse@some-other-domain.tld'],
+ 'cc-field': ['mariane_dach@davis.info']
+ }
+ }
+
};
var rawMultipartMail = {
@@ -73,7 +128,15 @@ define(function() {
'Content-Transfer-Encoding: quoted-printable\n' +
'\n' +
'<p><b>Hello everyone!</b></p>\n' +
- '--asdfghjkl--\n'
+ '--asdfghjkl--\n',
+ replying: {
+ single: 'laurel@hamil.info',
+ all: {
+ 'to-field': ['laurel@hamil.info'],
+ 'cc-field': []
+ }
+ }
+
};
var simpleTextPlainMail = {
@@ -158,6 +221,7 @@ define(function() {
draft: rawDraftMail,
recieved: rawRecievedMail,
recievedWithCC: rawRecievedWithCCMail,
+ rawMailWithMultipleTo: rawMailWithMultipleTo,
multipart: rawMultipartMail
},
parsedMail: {