blob: 8b941d99d61df60b0e149a893b47888c9047756a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/**
* 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('ItemResource', () => {
'use strict';
let resource;
beforeEach(module('News', ($provide) => {
$provide.value('BASE_URL', 'base');
}));
beforeEach(inject((FeedResource) => {
resource = FeedResource;
FeedResource.add({id: 1, url: 'ye', unreadCount: 45});
FeedResource.add({id: 2, url: 'sye', unreadCount: 25});
FeedResource.add({id: 3, url: '1sye', unreadCount: 0});
}));
it('should mark all read', inject((FeedResource) => {
FeedResource.markRead();
expect(FeedResource.getUnreadCount()).toBe(0);
}));
it('should mark a feed read', inject((FeedResource) => {
FeedResource.markFeedRead(1);
expect(FeedResource.get('ye').unreadCount).toBe(0);
}));
it('should mark an item read', inject((FeedResource) => {
FeedResource.markItemOfFeedRead(1);
expect(FeedResource.get('ye').unreadCount).toBe(44);
}));
it('should mark an item unread', inject((FeedResource) => {
FeedResource.markItemOfFeedUnread(1);
expect(FeedResource.get('ye').unreadCount).toBe(46);
}));
});
|