diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-11 14:32:59 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-11 14:32:59 +0200 |
commit | 793bd2177367c32d205c19950be33a8afc3c76e1 (patch) | |
tree | 7a36495ecb43e998e95dd21ec60ce943338ad80c /js/tests/unit/service/ItemResourceSpec.js | |
parent | ea9ebd4826fe9807af5bc17e786b3dc58f163970 (diff) |
port to ES5, fix unread count going into minus
Diffstat (limited to 'js/tests/unit/service/ItemResourceSpec.js')
-rw-r--r-- | js/tests/unit/service/ItemResourceSpec.js | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/js/tests/unit/service/ItemResourceSpec.js b/js/tests/unit/service/ItemResourceSpec.js index f93d92caa..6e32fc5bd 100644 --- a/js/tests/unit/service/ItemResourceSpec.js +++ b/js/tests/unit/service/ItemResourceSpec.js @@ -7,36 +7,41 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('ItemResource', () => { +describe('ItemResource', function () { 'use strict'; - let http; + var http; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); $provide.constant('ITEM_BATCH_SIZE', 5); })); - beforeEach(inject(($httpBackend) => { + beforeEach(inject(function ($httpBackend) { http = $httpBackend; })); + afterEach(function () { + http.verifyNoOutstandingExpectation(); + http.verifyNoOutstandingRequest(); + }); - it('should receive the newestItemId', inject((ItemResource) => { + + it('should receive the newestItemId', inject(function (ItemResource) { ItemResource.receive(3, 'newestItemId'); expect(ItemResource.getNewestItemId()).toBe(3); })); - it('should receive the newestItemId', inject((ItemResource) => { + it('should receive the newestItemId', inject(function (ItemResource) { ItemResource.receive(2, 'starred'); expect(ItemResource.getStarredCount()).toBe(2); })); - it ('should mark item as read', inject((ItemResource) => { + it ('should mark item as read', inject(function (ItemResource) { http.expectPOST('base/items/3/read', {isRead: true}).respond(200, {}); ItemResource.receive([ @@ -60,7 +65,7 @@ describe('ItemResource', () => { })); - it ('should mark multiple item as read', inject((ItemResource) => { + it ('should mark multiple item as read', inject(function (ItemResource) { http.expectPOST('base/items/read/multiple', { itemIds: [3, 4] }).respond(200, {}); @@ -88,7 +93,7 @@ describe('ItemResource', () => { - it ('should star item', inject((ItemResource) => { + it ('should star item', inject(function (ItemResource) { http.expectPOST('base/items/4/a/star', {isStarred: true}) .respond(200, {}); @@ -115,7 +120,7 @@ describe('ItemResource', () => { })); - it ('should mark feed as read', inject((ItemResource) => { + it ('should mark feed as read', inject(function (ItemResource) { http.expectPOST('base/feeds/4/read').respond(200, {}); ItemResource.receive([ @@ -145,7 +150,7 @@ describe('ItemResource', () => { })); - it ('should mark all as read', inject((ItemResource) => { + it ('should mark all as read', inject(function (ItemResource) { http.expectPOST('base/items/read').respond(200, {}); ItemResource.receive([ @@ -176,7 +181,7 @@ describe('ItemResource', () => { })); - it ('toggle star', inject((ItemResource) => { + it ('toggle star', inject(function (ItemResource) { ItemResource.receive([ { id: 3, @@ -198,7 +203,7 @@ describe('ItemResource', () => { })); - it ('should auto page', inject((ItemResource) => { + it ('should auto page', inject(function (ItemResource) { http.expectGET('base/items?id=4&limit=5&offset=3&type=3') .respond(200, {}); @@ -226,10 +231,4 @@ describe('ItemResource', () => { })); - afterEach(() => { - http.verifyNoOutstandingExpectation(); - http.verifyNoOutstandingRequest(); - }); - - });
\ No newline at end of file |