summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/service/FeedResourceSpec.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-11 20:26:04 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-11 20:26:04 +0200
commitf3091d84e14537a42334e66ea6588cf2b83f9ab6 (patch)
tree943151aa564177e956d5dc1b2fff12845e48c4c0 /js/tests/unit/service/FeedResourceSpec.js
parentf50dba835fa58f9ba979a9038ffd185ab8fe3b96 (diff)
various work on creating feeds, folders and showing folders
Diffstat (limited to 'js/tests/unit/service/FeedResourceSpec.js')
-rw-r--r--js/tests/unit/service/FeedResourceSpec.js40
1 files changed, 37 insertions, 3 deletions
diff --git a/js/tests/unit/service/FeedResourceSpec.js b/js/tests/unit/service/FeedResourceSpec.js
index 839ae650d..4b0f291f8 100644
--- a/js/tests/unit/service/FeedResourceSpec.js
+++ b/js/tests/unit/service/FeedResourceSpec.js
@@ -138,15 +138,15 @@ describe('FeedResource', function () {
it ('should move a feed', inject(function (FeedResource) {
- http.expectPOST('base/feeds/3/move', {
+ http.expectPOST('base/feeds/2/move', {
parentFolderId: 5
}).respond(200, {});
- FeedResource.move('1sye', 5);
+ FeedResource.move(2, 5);
http.flush();
- expect(FeedResource.get('1sye').folderId).toBe(5);
+ expect(FeedResource.get('sye').folderId).toBe(5);
}));
@@ -165,6 +165,40 @@ describe('FeedResource', function () {
}));
+ it ('should display a feed error', inject(function (FeedResource) {
+ http.expectPOST('base/feeds', {
+ parentFolderId: 5,
+ url: 'hey',
+ title: 'ABC'
+ }).respond(400, {message: 'noo'});
+
+ FeedResource.create('hey', 5, 'abc');
+
+ http.flush();
+
+ expect(FeedResource.get('hey').error).toBe('noo');
+ expect(FeedResource.get('hey').faviconLink).toBe('');
+ }));
+
+
+ it ('should create a feed with no folder', inject(function (FeedResource) {
+ http.expectPOST('base/feeds', {
+ parentFolderId: 0,
+ url: 'hey',
+ title: 'ABC'
+ }).respond(200, {});
+
+ FeedResource.create('hey', undefined, 'abc');
+
+ http.flush();
+
+ expect(FeedResource.get('hey').folderId).toBe(0);
+ expect(FeedResource.get('hey').faviconLink).toBe(
+ '/base/apps/news/css/loading.gif');
+ }));
+
+
+
it ('should not create a feed if it exists', inject(function (
FeedResource) {
http.expectPOST('base/feeds', {