summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-05 23:53:56 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-05 23:53:56 +0200
commit4b169b4561dd752cfe717e17a66bc3cf61f7627d (patch)
treec86aa0a46dce64dc563199c932c6c68b81d76e8d /js/tests
parent7f2cc571f6f4c5e96ab2b79f359958eceea0acbc (diff)
dont allow setting read and unread if it doesnt change the status
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/services/bl/itemblSpec.coffee24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/tests/services/bl/itemblSpec.coffee b/js/tests/services/bl/itemblSpec.coffee
index cbaef5488..4c2a5d660 100644
--- a/js/tests/services/bl/itemblSpec.coffee
+++ b/js/tests/services/bl/itemblSpec.coffee
@@ -117,6 +117,17 @@ describe 'ItemBl', ->
expect(@persistence.readItem).toHaveBeenCalledWith(2)
+ it 'should no set an item read if its already read', =>
+ @persistence.readItem = jasmine.createSpy('read item')
+
+ item = {id: 2, feedId: 5, guidHash: 'a3', status: 0}
+ @ItemModel.add(item)
+ item.setRead()
+
+ @ItemBl.setRead(2)
+ expect(@persistence.readItem).not.toHaveBeenCalled()
+
+
it 'should return false when item kept unread does not exist', =>
expect(@ItemBl.isKeptUnread(2)).toBe(false)
@@ -156,6 +167,19 @@ describe 'ItemBl', ->
expect(@persistence.unreadItem).toHaveBeenCalledWith(2)
+ it 'should not set an item as unread if its unread', =>
+ @persistence.unreadItem = jasmine.createSpy('unread item')
+
+ item = {id: 2, feedId: 5, guidHash: 'a3', status: 0}
+ @ItemModel.add(item)
+ item.setUnread()
+
+ @ItemBl.setUnread(2)
+
+ expect(item.isRead()).toBe(false)
+ expect(@persistence.unreadItem).not.toHaveBeenCalled()
+
+
it 'should set item as unread if kept unread is toggled and it is read', =>
@persistence.unreadItem = jasmine.createSpy('unread item')