/**
* ownCloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
describe('NavigationController', function () {
'use strict';
var controller;
beforeEach(module('News', function ($provide) {
$provide.value('BASE_URL', 'base');
$provide.value('FEED_TYPE', {
FEED: 0,
FOLDER: 1,
STARRED: 2,
SUBSCRIPTIONS: 3,
SHARED: 4
});
$provide.constant('ITEM_BATCH_SIZE', 5);
}));
beforeEach(inject(function ($controller, FeedResource) {
controller = $controller('NavigationController');
FeedResource.receive([
{id: 1, folderId: 3, url: 'ye', unreadCount: 45},
{id: 2, folderId: 4, url: 'sye', unreadCount: 25},
{id: 3, folderId: 3, title: 'hore', url: '1sye', unreadCount: 1}
]);
}));
it('should expose Feeds', inject(function (FeedResource) {
FeedResource.add({url: 1});
expect(controller.getFeeds()).toBe(FeedResource.getAll());
}));
it('should expose Folders', inject(function (FolderResource) {
FolderResource.add({name: 1});
expect(controller.getFolders()).toBe(FolderResource.getAll());
}));
it('should mark Folders read', inject(function ($controller) {
var FeedResource = {
markFolderRead: jasmine.createSpy('folder'),
getByFolderId: function () {
return [
{id: 3},
{id: 4}
];
}
};
var ItemResource