mirror of
https://github.com/moparisthebest/mail
synced 2025-01-08 12:08:07 -05:00
cleanup and test email dao integration of imap-client
This commit is contained in:
parent
a3849af57f
commit
fbaa43aff6
@ -6,9 +6,8 @@ define(function(require) {
|
||||
moment = require('moment'),
|
||||
emailDao;
|
||||
|
||||
var MailListCtrl = function($scope, $routeParams) {
|
||||
$scope.folder = $routeParams.folder || 'INBOX';
|
||||
$scope.messageId = $routeParams.messageId;
|
||||
var MailListCtrl = function($scope) {
|
||||
$scope.folder = 'INBOX';
|
||||
emailDao = appController._emailDao;
|
||||
|
||||
$scope.select = function(email) {
|
||||
|
@ -284,7 +284,16 @@ define(function(require) {
|
||||
EmailDAO.prototype.imapListFolders = function(callback) {
|
||||
var self = this;
|
||||
|
||||
self._imapClient.listFolders(callback);
|
||||
self._imapClient.listAllFolders(callback);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the number of unread message for a folder
|
||||
*/
|
||||
EmailDAO.prototype.unreadMessages = function(path, callback) {
|
||||
var self = this;
|
||||
|
||||
self._imapClient.unreadMessages(path, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -241,9 +241,20 @@ define(function(require) {
|
||||
|
||||
describe('IMAP: list folders', function() {
|
||||
it('should work', function(done) {
|
||||
imapClientStub.listFolders.yields();
|
||||
imapClientStub.listAllFolders.yields();
|
||||
emailDao.imapListFolders(function(err) {
|
||||
expect(imapClientStub.listFolders.calledOnce).to.be.true;
|
||||
expect(imapClientStub.listAllFolders.calledOnce).to.be.true;
|
||||
expect(err).to.not.exist;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('IMAP: get unread messages for folder', function() {
|
||||
it('should work', function(done) {
|
||||
imapClientStub.unreadMessages.yields();
|
||||
emailDao.unreadMessages(function(err) {
|
||||
expect(imapClientStub.unreadMessages.calledOnce).to.be.true;
|
||||
expect(err).to.not.exist;
|
||||
done();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user