add unit test for syncOutbox

This commit is contained in:
Felix Hammerl 2014-02-25 15:10:29 +01:00
parent 336b4a4a7f
commit debb06c943
1 changed files with 24 additions and 1 deletions

View File

@ -2579,7 +2579,7 @@ define(function(require) {
it('should work', function(done) {
var publicKeys = ["PUBLIC KEY"];
dummyDecryptedMail.publicKeysArmored = publicKeys;
pgpMailerStub.send.withArgs({
encrypt: true,
cleartextMessage: str.message,
@ -2609,6 +2609,29 @@ define(function(require) {
expect(pgpMailerStub.send.calledOnce).to.be.true;
done();
});
});
});
describe('syncOutbox', function() {
it('should sync the outbox', function(done) {
var folder = 'FOLDAAAA';
dao._account.folders = [{
type: 'Folder',
path: folder
}];
var localListStub = sinon.stub(dao, '_localListMessages').withArgs({
folder: folder
}).yields(null, [dummyEncryptedMail]);
dao.syncOutbox({
folder: folder
}, function(err) {
expect(err).to.not.exist;
expect(localListStub.calledOnce).to.be.true;
expect(dao._account.folders[0].messages.length).to.equal(1);
done();
});
});