From d67f2a5d534714562eb0d542941f63e5ce8baf52 Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Wed, 5 Nov 2014 14:25:05 +0100 Subject: [PATCH 1/4] [WO-660] Add \Flagged to message flags --- package.json | 2 +- src/js/dao/email-dao.js | 4 +++- test/integration/email-dao-test.js | 7 +++++-- test/unit/email-dao-test.js | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b53d77f..ac49c0b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "axe-logger": "~0.0.2", "crypto-lib": "~0.2.1", "dompurify": "~0.4.2", - "imap-client": "~0.5.0", + "imap-client": "https://github.com/whiteout-io/imap-client/tarball/dev/WO-660", "jquery": "~2.1.1", "mailreader": "~0.4.0", "ng-infinite-scroll": "~1.1.2", diff --git a/src/js/dao/email-dao.js b/src/js/dao/email-dao.js index 8c89ba6..3000f73 100644 --- a/src/js/dao/email-dao.js +++ b/src/js/dao/email-dao.js @@ -585,7 +585,8 @@ EmailDAO.prototype.setFlags = function(options, callback) { folder: folder, uid: options.message.uid, unread: options.message.unread, - answered: options.message.answered + answered: options.message.answered, + flagged: options.message.flagged }, function(err) { if (err) { done(err); @@ -612,6 +613,7 @@ EmailDAO.prototype.setFlags = function(options, callback) { // set the flags var storedMessage = storedMessages[0]; storedMessage.unread = options.message.unread; + storedMessage.flagged = options.message.flagged; storedMessage.answered = options.message.answered; storedMessage.modseq = options.message.modseq || storedMessage.modseq; diff --git a/test/integration/email-dao-test.js b/test/integration/email-dao-test.js index 570a098..de4c63c 100644 --- a/test/integration/email-dao-test.js +++ b/test/integration/email-dao-test.js @@ -321,11 +321,13 @@ describe('Email DAO integration tests', function() { it('should receive new messages', function(done) { emailDao.onIncomingMessage = function(messages) { expect(messages.length).to.equal(1); - expect(messages[0].answered).to.be.false; + expect(messages[0].answered).to.be.true; + expect(messages[0].flagged).to.be.true; + expect(messages[0].unread).to.be.false; done(); }; - imapServer.appendMessage('INBOX', ['$My$Flag'], false, 'Message-id: \r\nSubject: new message\r\n\r\nhello world!'); + imapServer.appendMessage('INBOX', ['\\Flagged', '\\Seen', '\\Answered'], false, 'Message-id: \r\nSubject: new message\r\n\r\nhello world!'); }); it('should delete a message', function(done) { @@ -391,6 +393,7 @@ describe('Email DAO integration tests', function() { var message = inbox.messages[1]; message.unread = false; message.answered = true; + message.flagged = true; emailDao.setFlags({ folder: inbox, diff --git a/test/unit/email-dao-test.js b/test/unit/email-dao-test.js index 646aac6..4c86eed 100644 --- a/test/unit/email-dao-test.js +++ b/test/unit/email-dao-test.js @@ -728,7 +728,8 @@ describe('Email DAO unit tests', function() { folder: inboxFolder, uid: message.uid, unread: message.unread, - answered: message.answered + answered: message.answered, + flagged: message.flagged }).yieldsAsync(); localListStub.withArgs({ From fe6275961390751738fc54f60af9d592fd766031 Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Wed, 5 Nov 2014 14:27:21 +0100 Subject: [PATCH 2/4] Disable logging during tests --- test/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/main.js b/test/main.js index 8c26ce7..ce266e7 100644 --- a/test/main.js +++ b/test/main.js @@ -47,4 +47,7 @@ if (!Function.prototype.bind) { })(); // set worker path for tests -require('../src/js/app-config').config.workerPath = '../lib'; \ No newline at end of file +require('../src/js/app-config').config.workerPath = '../lib'; + +var axe = require('axe-logger'); +axe.removeAppender(axe.defaultAppender); \ No newline at end of file From 40a4b337482528128ac00ecf19b064a45dcf05fb Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Wed, 5 Nov 2014 14:27:34 +0100 Subject: [PATCH 3/4] Use chai 1.9.x --- package.json | 2 +- test/integration/email-dao-test.js | 2 +- test/unit/backbutton-handler-test.js | 2 +- test/unit/email-dao-test.js | 2 +- test/unit/mail-list-ctrl-test.js | 2 +- test/unit/outbox-bo-test.js | 4 ++-- test/unit/update-handler-test.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ac49c0b..2d7b7ef 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "angularjs": "https://github.com/whiteout-io/angular.js/tarball/npm-version", "browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master", "browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master", - "chai": "~1.7.2", + "chai": "~1.9.2", "grunt": "~0.4.1", "grunt-browserify": "^3.0.1", "grunt-contrib-clean": "~0.5.0", diff --git a/test/integration/email-dao-test.js b/test/integration/email-dao-test.js index de4c63c..1f86895 100644 --- a/test/integration/email-dao-test.js +++ b/test/integration/email-dao-test.js @@ -14,7 +14,7 @@ var ImapClient = require('imap-client'), describe('Email DAO integration tests', function() { this.timeout(100000); - chai.Assertion.includeStack = true; + chai.config.includeStack = true; var emailDao, imapClient, imapMessages, imapFolders, imapServer, smtpServer, smtpClient, userStorage, mockKeyPair, inbox, spam; diff --git a/test/unit/backbutton-handler-test.js b/test/unit/backbutton-handler-test.js index 66fc05b..9cb0892 100644 --- a/test/unit/backbutton-handler-test.js +++ b/test/unit/backbutton-handler-test.js @@ -3,7 +3,7 @@ var btnHandler = require('../../src/js/util/backbutton-handler'); describe('Backbutton Handler', function() { - chai.Assertion.includeStack = true; + chai.config.includeStack = true; var scope, event; diff --git a/test/unit/email-dao-test.js b/test/unit/email-dao-test.js index 4c86eed..2b53f77 100644 --- a/test/unit/email-dao-test.js +++ b/test/unit/email-dao-test.js @@ -13,7 +13,7 @@ var mailreader = require('mailreader'), describe('Email DAO unit tests', function() { // show the stack trace when an error occurred - chai.Assertion.includeStack = true; + chai.config.includeStack = true; // SUT var dao; diff --git a/test/unit/mail-list-ctrl-test.js b/test/unit/mail-list-ctrl-test.js index d05c1a8..6eadd76 100644 --- a/test/unit/mail-list-ctrl-test.js +++ b/test/unit/mail-list-ctrl-test.js @@ -8,7 +8,7 @@ var mocks = angular.mock, appController = require('../../src/js/app-controller'), notification = require('../../src/js/util/notification'); -chai.Assertion.includeStack = true; +chai.config.includeStack = true; describe('Mail List controller unit test', function() { var scope, ctrl, origEmailDao, emailDaoMock, keychainMock, deviceStorageMock, diff --git a/test/unit/outbox-bo-test.js b/test/unit/outbox-bo-test.js index 55cc2a5..e5df498 100644 --- a/test/unit/outbox-bo-test.js +++ b/test/unit/outbox-bo-test.js @@ -5,12 +5,12 @@ var OutboxBO = require('../../src/js/bo/outbox'), EmailDAO = require('../../src/js/dao/email-dao'), DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'); -chai.Assertion.includeStack = true; - describe('Outbox Business Object unit test', function() { var outbox, emailDaoStub, devicestorageStub, keychainStub, dummyUser = 'spiderpig@springfield.com'; + chai.config.includeStack = true; + beforeEach(function() { emailDaoStub = sinon.createStubInstance(EmailDAO); emailDaoStub._account = { diff --git a/test/unit/update-handler-test.js b/test/unit/update-handler-test.js index 8267938..7f1407a 100644 --- a/test/unit/update-handler-test.js +++ b/test/unit/update-handler-test.js @@ -9,7 +9,7 @@ var DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'), describe('UpdateHandler', function() { var updateHandler, appConfigStorageStub, authStub, userStorageStub, origDbVersion; - chai.Assertion.includeStack = true; + chai.config.includeStack = true; beforeEach(function() { origDbVersion = cfg.dbVersion; From f62ad4b868c9995868a6a1d0a64ff23ee46b8f4a Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 6 Nov 2014 16:01:40 +0100 Subject: [PATCH 4/4] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2d7b7ef..81b6a0d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "axe-logger": "~0.0.2", "crypto-lib": "~0.2.1", "dompurify": "~0.4.2", - "imap-client": "https://github.com/whiteout-io/imap-client/tarball/dev/WO-660", + "imap-client": "~0.6.0", "jquery": "~2.1.1", "mailreader": "~0.4.0", "ng-infinite-scroll": "~1.1.2", @@ -72,4 +72,4 @@ "grunt-svgmin": "~1.0.0", "grunt-svgstore": "~0.3.4" } -} \ No newline at end of file +}