diff options
Diffstat (limited to 'js/tests/unit/service')
-rw-r--r-- | js/tests/unit/service/ItemResourceSpec.js | 24 | ||||
-rw-r--r-- | js/tests/unit/service/ResourceSpec.js | 2 |
2 files changed, 24 insertions, 2 deletions
diff --git a/js/tests/unit/service/ItemResourceSpec.js b/js/tests/unit/service/ItemResourceSpec.js index acbf0850c..8d0f1864e 100644 --- a/js/tests/unit/service/ItemResourceSpec.js +++ b/js/tests/unit/service/ItemResourceSpec.js @@ -10,7 +10,9 @@ describe('ItemResource', () => { 'use strict'; - beforeEach(module('News')); + beforeEach(module('News', ($provide) => { + $provide.value('BASE_URL', 'base'); + })); it('should receive the newestItemId', inject((ItemResource) => { @@ -40,4 +42,24 @@ describe('ItemResource', () => { expect(ItemResource.size()).toBe(2); })); + + it ('should mark item as read', inject((ItemResource) => { + ItemResource.receive([ + { + id: 3, + feedId: 4, + unread: true + }, + { + id: 4, + feedId: 3, + unread: true + } + ], 'items'); + + ItemResource.markRead(3); + + expect(ItemResource.get(3).unread).toBe(false); + })); + });
\ No newline at end of file diff --git a/js/tests/unit/service/ResourceSpec.js b/js/tests/unit/service/ResourceSpec.js index 2fead3479..b1b8ed054 100644 --- a/js/tests/unit/service/ResourceSpec.js +++ b/js/tests/unit/service/ResourceSpec.js @@ -17,7 +17,7 @@ describe('Resource', () => { beforeEach(inject((Resource, $http) => { class ChildResource extends Resource { constructor ($http) { - super($http); + super($http, 'base'); } } |