mirror of
https://github.com/moparisthebest/mail
synced 2025-01-09 04:28:16 -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'),
|
moment = require('moment'),
|
||||||
emailDao;
|
emailDao;
|
||||||
|
|
||||||
var MailListCtrl = function($scope, $routeParams) {
|
var MailListCtrl = function($scope) {
|
||||||
$scope.folder = $routeParams.folder || 'INBOX';
|
$scope.folder = 'INBOX';
|
||||||
$scope.messageId = $routeParams.messageId;
|
|
||||||
emailDao = appController._emailDao;
|
emailDao = appController._emailDao;
|
||||||
|
|
||||||
$scope.select = function(email) {
|
$scope.select = function(email) {
|
||||||
|
@ -284,7 +284,16 @@ define(function(require) {
|
|||||||
EmailDAO.prototype.imapListFolders = function(callback) {
|
EmailDAO.prototype.imapListFolders = function(callback) {
|
||||||
var self = this;
|
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() {
|
describe('IMAP: list folders', function() {
|
||||||
it('should work', function(done) {
|
it('should work', function(done) {
|
||||||
imapClientStub.listFolders.yields();
|
imapClientStub.listAllFolders.yields();
|
||||||
emailDao.imapListFolders(function(err) {
|
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;
|
expect(err).to.not.exist;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user