[WO-696] List trash before flagged in wellknown folders

This commit is contained in:
Felix Hammerl 2014-11-05 11:36:42 +01:00
parent 8f1fd2de5f
commit 14dc80ec3c
2 changed files with 23 additions and 6 deletions

View File

@ -1442,8 +1442,8 @@ EmailDAO.prototype._initFoldersFromImap = function(callback) {
FOLDER_TYPE_SENT, FOLDER_TYPE_SENT,
config.outboxMailboxType, config.outboxMailboxType,
FOLDER_TYPE_DRAFTS, FOLDER_TYPE_DRAFTS,
FOLDER_TYPE_FLAGGED, FOLDER_TYPE_TRASH,
FOLDER_TYPE_TRASH FOLDER_TYPE_FLAGGED
]; ];
// make sure the well known folders are detected // make sure the well known folders are detected

View File

@ -25,7 +25,7 @@ describe('Email DAO unit tests', function() {
var emailAddress, passphrase, asymKeySize, account; var emailAddress, passphrase, asymKeySize, account;
// test data // test data
var folders, inboxFolder, sentFolder, draftsFolder, outboxFolder, trashFolder, otherFolder, mockKeyPair; var folders, inboxFolder, sentFolder, draftsFolder, outboxFolder, trashFolder, flaggedFolder, otherFolder, mockKeyPair;
beforeEach(function() { beforeEach(function() {
// //
@ -70,6 +70,13 @@ describe('Email DAO unit tests', function() {
messages: [] messages: []
}; };
flaggedFolder = {
name: 'Flagged',
type: 'Flagged',
path: 'FLAGGED',
messages: []
};
otherFolder = { otherFolder = {
name: 'Other', name: 'Other',
type: 'Other', type: 'Other',
@ -2105,6 +2112,7 @@ describe('Email DAO unit tests', function() {
Sent: [sentFolder], Sent: [sentFolder],
Drafts: [draftsFolder], Drafts: [draftsFolder],
Trash: [trashFolder], Trash: [trashFolder],
Flagged: [flaggedFolder],
Other: [otherFolder] Other: [otherFolder]
}); });
devicestorageStub.storeList.withArgs(sinon.match(function(arg) { devicestorageStub.storeList.withArgs(sinon.match(function(arg) {
@ -2123,9 +2131,12 @@ describe('Email DAO unit tests', function() {
expect(arg[0][4].name).to.deep.equal(trashFolder.name); expect(arg[0][4].name).to.deep.equal(trashFolder.name);
expect(arg[0][4].path).to.deep.equal(trashFolder.path); expect(arg[0][4].path).to.deep.equal(trashFolder.path);
expect(arg[0][4].type).to.deep.equal(trashFolder.type); expect(arg[0][4].type).to.deep.equal(trashFolder.type);
expect(arg[0][5].name).to.deep.equal(otherFolder.name); expect(arg[0][5].name).to.deep.equal(flaggedFolder.name);
expect(arg[0][5].path).to.deep.equal(otherFolder.path); expect(arg[0][5].path).to.deep.equal(flaggedFolder.path);
expect(arg[0][5].type).to.deep.equal(otherFolder.type); expect(arg[0][5].type).to.deep.equal(flaggedFolder.type);
expect(arg[0][6].name).to.deep.equal(otherFolder.name);
expect(arg[0][6].path).to.deep.equal(otherFolder.path);
expect(arg[0][6].type).to.deep.equal(otherFolder.type);
return true; return true;
}), 'folders').yieldsAsync(); }), 'folders').yieldsAsync();
@ -2151,6 +2162,7 @@ describe('Email DAO unit tests', function() {
Sent: [sentFolder], Sent: [sentFolder],
Drafts: [draftsFolder], Drafts: [draftsFolder],
Trash: [trashFolder], Trash: [trashFolder],
Flagged: [flaggedFolder],
Other: [otherFolder] Other: [otherFolder]
}); });
devicestorageStub.storeList.withArgs(sinon.match(function(arg) { devicestorageStub.storeList.withArgs(sinon.match(function(arg) {
@ -2179,6 +2191,11 @@ describe('Email DAO unit tests', function() {
path: trashFolder.path, path: trashFolder.path,
type: trashFolder.type, type: trashFolder.type,
wellknown: true wellknown: true
}, {
name: flaggedFolder.name,
path: flaggedFolder.path,
type: flaggedFolder.type,
wellknown: true
}, { }, {
name: otherFolder.name, name: otherFolder.name,
path: otherFolder.path, path: otherFolder.path,