diff options
Diffstat (limited to 'js/tests/unit/service')
-rw-r--r-- | js/tests/unit/service/ItemResourceSpec.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/js/tests/unit/service/ItemResourceSpec.js b/js/tests/unit/service/ItemResourceSpec.js index 870824efe..0316d39cc 100644 --- a/js/tests/unit/service/ItemResourceSpec.js +++ b/js/tests/unit/service/ItemResourceSpec.js @@ -155,6 +155,37 @@ describe('ItemResource', () => { })); + it ('should mark all as read', inject((ItemResource) => { + http.expectPOST('base/items/read').respond(200, {}); + + ItemResource.receive([ + { + id: 3, + feedId: 4, + unread: true + }, + { + id: 4, + feedId: 3, + unread: true + }, + { + id: 5, + feedId: 4, + unread: true + } + ], 'items'); + + ItemResource.readAll(4); + + http.flush(); + + expect(ItemResource.get(3).unread).toBe(false); + expect(ItemResource.get(4).unread).toBe(false); + expect(ItemResource.get(5).unread).toBe(false); + })); + + afterEach(() => { http.verifyNoOutstandingExpectation(); http.verifyNoOutstandingRequest(); |