From 2b4da592f1c8a2210f9ba49a9e24eb2056e5d4a8 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 22 May 2014 02:15:56 +0200 Subject: simplify star and read --- js/tests/unit/controller/AppControllerSpec.js | 4 +++- js/tests/unit/controller/ContentControllerSpec.js | 4 +++- js/tests/unit/service/ItemResourceSpec.js | 24 ++++++++++++++++++++++- js/tests/unit/service/ResourceSpec.js | 2 +- 4 files changed, 30 insertions(+), 4 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/controller/AppControllerSpec.js b/js/tests/unit/controller/AppControllerSpec.js index fc5780a40..772fdc565 100644 --- a/js/tests/unit/controller/AppControllerSpec.js +++ b/js/tests/unit/controller/AppControllerSpec.js @@ -12,7 +12,9 @@ describe('AppController', () => { let controller; - beforeEach(module('News')); + beforeEach(module('News', ($provide) => { + $provide.value('BASE_URL', 'base'); + })); beforeEach(inject(($controller) => { controller = $controller('AppController'); diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index 1dbd3d936..422bd21f4 100644 --- a/js/tests/unit/controller/ContentControllerSpec.js +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -10,7 +10,9 @@ describe('ContentController', () => { 'use strict'; - beforeEach(module('News')); + beforeEach(module('News', ($provide) => { + $provide.value('BASE_URL', 'base'); + })); it('should publish data to models', inject(($controller, Publisher, 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'); } } -- cgit v1.2.3