summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-16 17:24:15 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-16 17:24:15 +0200
commite48be020ad106b16c399c2f4a46741f1f31ea3f3 (patch)
tree30040bb5b12b62dc58ba39c9fe5d7265a7ac3918 /js/tests
parent42ca456a059b7bb228a37a60cd82f141fe927e54 (diff)
fix bug that prevented marking read if the highestitemid was 0 also clientside
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/services/businesslayer/feedbusinesslayerSpec.coffee16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
index 8e09e7be9..1b9f009d5 100644
--- a/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
+++ b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
@@ -89,6 +89,7 @@ describe 'FeedBusinessLayer', ->
it 'should mark feed as read', =>
+ @ActiveFeed.handle({type: @FeedType.Feed, id: 5})
@persistence.setFeedRead = jasmine.createSpy('setFeedRead')
@FeedModel.add({id: 5, unreadCount:2, folderId: 2, urlHash: 'a1'})
@ItemModel.add({id: 6, feedId: 5, guidHash: 'a1'})
@@ -103,6 +104,21 @@ describe 'FeedBusinessLayer', ->
expect(@ItemModel.getById(2).isRead()).toBeTruthy()
+ it 'should mark feed as read and set 0 if as highest id if its not active',=>
+ @persistence.setFeedRead = jasmine.createSpy('setFeedRead')
+ @FeedModel.add({id: 5, unreadCount:2, folderId: 2, urlHash: 'a1'})
+ @ItemModel.add({id: 6, feedId: 5, guidHash: 'a1'})
+ @ItemModel.add({id: 3, feedId: 5, guidHash: 'a2'})
+ @ItemModel.add({id: 2, feedId: 5, guidHash: 'a3'})
+ @FeedBusinessLayer.markFeedRead(5)
+
+ expect(@persistence.setFeedRead).toHaveBeenCalledWith(5, 0)
+ expect(@FeedModel.getById(5).unreadCount).toBe(0)
+ expect(@ItemModel.getById(6).isRead()).toBeTruthy()
+ expect(@ItemModel.getById(3).isRead()).toBeTruthy()
+ expect(@ItemModel.getById(2).isRead()).toBeTruthy()
+
+
it 'should mark all as read', =>
@persistence.setFeedRead = jasmine.createSpy('setFeedRead')
@FeedModel.add({id: 3, unreadCount:134, folderId: 3, urlHash: 'a1'})