diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-20 17:01:59 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-20 17:01:59 +0200 |
commit | 5a7b1e0c36c2dd564f44568de766118b07be49ad (patch) | |
tree | 23b9f80bb4509dd51948c3851660f5fa3754031d /js/tests | |
parent | b5d5b2b22a2b4aabd4c9bb5c8b89aae10facc735 (diff) |
rename model to resource
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/unit/controller/AppControllerSpec.js | 8 | ||||
-rw-r--r-- | js/tests/unit/controller/ContentControllerSpec.js | 8 | ||||
-rw-r--r-- | js/tests/unit/models/ItemSpec.js | 43 | ||||
-rw-r--r-- | js/tests/unit/service/ItemResourceSpec.js | 43 | ||||
-rw-r--r-- | js/tests/unit/service/ResourceSpec.js (renamed from js/tests/unit/models/ModelSpec.js) | 10 |
5 files changed, 57 insertions, 55 deletions
diff --git a/js/tests/unit/controller/AppControllerSpec.js b/js/tests/unit/controller/AppControllerSpec.js index b7dad7492..d44d8b0c3 100644 --- a/js/tests/unit/controller/AppControllerSpec.js +++ b/js/tests/unit/controller/AppControllerSpec.js @@ -29,15 +29,15 @@ describe('AppController', function () { })); - it('should expose set firstrun if feeds', inject(function (Feed) { - Feed.add({url: 'test'}); + it('should expose set firstrun if feeds', inject(function (FeedResource) { + FeedResource.add({url: 'test'}); expect(controller.isFirstRun()).toBe(false); })); - it('should expose set firstrun if folders', inject(function (Folder) { - Folder.add({name: 'test'}); + it('should expose set firstrun if folders', inject(function (FolderResource) { + FolderResource.add({name: 'test'}); expect(controller.isFirstRun()).toBe(false); })); diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index 9e3693e86..c99cb79ab 100644 --- a/js/tests/unit/controller/ContentControllerSpec.js +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -13,9 +13,11 @@ describe('ContentController', function () { beforeEach(module('News')); - it('should publish data to models', inject(function ($controller, Publisher, Feed, Item) { - Publisher.subscribe(Item).toChannels('items'); - Publisher.subscribe(Feed).toChannels('feeds'); + it('should publish data to models', inject(function ($controller, Publisher, + FeedResource, ItemResource) { + + Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(FeedResource).toChannels('feeds'); var controller = $controller('ContentController', { data: { diff --git a/js/tests/unit/models/ItemSpec.js b/js/tests/unit/models/ItemSpec.js deleted file mode 100644 index 85ee5789e..000000000 --- a/js/tests/unit/models/ItemSpec.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * ownCloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @copyright Bernhard Posselt 2014 - */ -describe('Item', function () { - 'use strict'; - - beforeEach(module('News')); - - - it('should receive the newestItemId', inject(function (Item) { - Item.receive(3, 'newestItemId'); - - expect(Item.getNewestItemId()).toBe(3); - })); - - - it('should receive the newestItemId', inject(function (Item) { - Item.receive(2, 'starred'); - - expect(Item.getStarredCount()).toBe(2); - })); - - - it('should receive items', inject(function (Item) { - Item.receive([ - { - id: 3 - }, - { - id: 4 - } - ], 'items'); - - expect(Item.size()).toBe(2); - })); - -});
\ No newline at end of file diff --git a/js/tests/unit/service/ItemResourceSpec.js b/js/tests/unit/service/ItemResourceSpec.js new file mode 100644 index 000000000..9d6c10ae0 --- /dev/null +++ b/js/tests/unit/service/ItemResourceSpec.js @@ -0,0 +1,43 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2014 + */ +describe('ItemResource', function () { + 'use strict'; + + beforeEach(module('News')); + + + it('should receive the newestItemId', inject(function (ItemResource) { + ItemResource.receive(3, 'newestItemId'); + + expect(ItemResource.getNewestItemId()).toBe(3); + })); + + + it('should receive the newestItemId', inject(function (ItemResource) { + ItemResource.receive(2, 'starred'); + + expect(ItemResource.getStarredCount()).toBe(2); + })); + + + it('should receive items', inject(function (ItemResource) { + ItemResource.receive([ + { + id: 3 + }, + { + id: 4 + } + ], 'items'); + + expect(ItemResource.size()).toBe(2); + })); + +});
\ No newline at end of file diff --git a/js/tests/unit/models/ModelSpec.js b/js/tests/unit/service/ResourceSpec.js index 6e1d0791b..ba877fcd4 100644 --- a/js/tests/unit/models/ModelSpec.js +++ b/js/tests/unit/service/ResourceSpec.js @@ -7,18 +7,18 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('Model', function () { +describe('Resource', function () { 'use strict'; var childModel; beforeEach(module('News')); - beforeEach(inject(function (Model) { + beforeEach(inject(function (Resource) { var ChildModel = function () { - Model.call(this, 'id'); + Resource.call(this, 'id'); }; - ChildModel.prototype = Object.create(Model.prototype); + ChildModel.prototype = Object.create(Resource.prototype); childModel = new ChildModel(); })); @@ -75,7 +75,7 @@ describe('Model', function () { }); - it('should delete a model', function () { + it('should delete a Resource', function () { var object1, object2; |