diff --git a/src/js/dao/email-dao.js b/src/js/dao/email-dao.js index a65f568..47daea2 100644 --- a/src/js/dao/email-dao.js +++ b/src/js/dao/email-dao.js @@ -564,42 +564,5 @@ define(function(require) { }, messageReady); }; - /** - * Checks if an item is already cached and if not, cache it. - */ - EmailDAO.prototype.cacheItem = function(folderName, item) { - var self = this; - - // check if account has a folders attribute - if (!self._account.folders) { - self._account.folders = {}; - } - // create folder if not existant - if (!self._account.folders[folderName]) { - self._account.folders[folderName] = {}; - } - - // cache item - self._account.folders[folderName][item.uid] = item; - }; - - /** - * Fetch an item from the cache with the following id - */ - EmailDAO.prototype.readCache = function(folderName, itemId) { - var self = this; - - // check if account has a folders attribute - if (!self._account.folders) { - return; - } - // check folder - if (!self._account.folders[folderName]) { - return; - } - - return self._account.folders[folderName][itemId]; - }; - return EmailDAO; }); \ No newline at end of file diff --git a/test/new-unit/email-dao-test.js b/test/new-unit/email-dao-test.js index eb228b8..9053929 100644 --- a/test/new-unit/email-dao-test.js +++ b/test/new-unit/email-dao-test.js @@ -217,49 +217,6 @@ define(function(require) { }); }); - describe('IMAP Caching', function() { - describe('write cache', function() { - it('should work if cache is empty', function() { - expect(emailDao._account.folders).to.not.exist; - emailDao.cacheItem('INBOX', { - uid: 42 - }); - expect(emailDao._account.folders.INBOX[42]).to.exist; - }); - - it('should work if cache is not empty', function() { - expect(emailDao._account.folders).to.not.exist; - emailDao.cacheItem('INBOX', { - uid: 42 - }); - emailDao.cacheItem('INBOX', { - uid: 43 - }); - expect(emailDao._account.folders.INBOX[42]).to.exist; - expect(emailDao._account.folders.INBOX[43]).to.exist; - }); - }); - - describe('read cache', function() { - it('should work if cache is empty', function() { - expect(emailDao._account.folders).to.not.exist; - var item = emailDao.readCache('INBOX', 42); - expect(item).to.not.exist; - }); - - it('should work if cache is not empty', function() { - expect(emailDao._account.folders).to.not.exist; - emailDao.cacheItem('INBOX', { - uid: 42 - }); - expect(emailDao._account.folders.INBOX[42]).to.exist; - - var item = emailDao.readCache('INBOX', 42); - expect(item.uid).to.equal(42); - }); - }); - }); - describe('IMAP: list folders', function() { it('should work', function(done) { imapClientStub.listAllFolders.yields();