diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-12 03:03:44 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-12 03:03:44 +0200 |
commit | 761412ebaaf0930499ca26e7acdd0965be5a50ae (patch) | |
tree | 24c62f2b64e12d92e339c16f96fb1f01dae7972c /js/tests/unit/service/FeedResourceSpec.js | |
parent | 1a04a1c73540be7c7294ef86b92df65bd91c5fc8 (diff) |
create folders!
Diffstat (limited to 'js/tests/unit/service/FeedResourceSpec.js')
-rw-r--r-- | js/tests/unit/service/FeedResourceSpec.js | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/js/tests/unit/service/FeedResourceSpec.js b/js/tests/unit/service/FeedResourceSpec.js index edf8ba46d..0878a4954 100644 --- a/js/tests/unit/service/FeedResourceSpec.js +++ b/js/tests/unit/service/FeedResourceSpec.js @@ -151,68 +151,67 @@ describe('FeedResource', function () { })); - it ('should create a feed', inject(function (FeedResource) { + it ('should create a feed and prepend http if not given', inject(function ( + FeedResource) { http.expectPOST('base/feeds', { parentFolderId: 5, - url: 'hey', + url: 'http://hey', title: 'ABC' }).respond(200, {}); - FeedResource.create('hey', 5, 'abc'); + FeedResource.create(' hey ', 5, ' abc'); http.flush(); - expect(FeedResource.get('hey').folderId).toBe(5); + expect(FeedResource.get('http://hey').folderId).toBe(5); })); - it ('should display a feed error', inject(function (FeedResource) { + it ('should create a feed', inject(function (FeedResource) { http.expectPOST('base/feeds', { parentFolderId: 5, - url: 'hey', + url: 'http://hey', title: 'ABC' - }).respond(400, {message: 'noo'}); + }).respond(200, {}); - FeedResource.create('hey', 5, 'abc'); + FeedResource.create('http://hey', 5, 'abc'); http.flush(); - expect(FeedResource.get('hey').error).toBe('noo'); - expect(FeedResource.get('hey').faviconLink).toBe(''); + expect(FeedResource.get('http://hey').folderId).toBe(5); })); - it ('should create a feed with no folder', inject(function (FeedResource) { + it ('should display a feed error', inject(function (FeedResource) { http.expectPOST('base/feeds', { - parentFolderId: 0, - url: 'hey', + parentFolderId: 5, + url: 'https://hey', title: 'ABC' - }).respond(200, {}); + }).respond(400, {message: 'noo'}); - FeedResource.create('hey', undefined, 'abc'); + FeedResource.create('https://hey', 5, 'abc'); http.flush(); - expect(FeedResource.get('hey').folderId).toBe(0); - expect(FeedResource.get('hey').faviconLink).toBe( - '/base/apps/news/css/loading.gif'); + expect(FeedResource.get('https://hey').error).toBe('noo'); + expect(FeedResource.get('https://hey').faviconLink).toBe(''); })); - - it ('should not create a feed if it exists', inject(function ( - FeedResource) { + it ('should create a feed with no folder', inject(function (FeedResource) { http.expectPOST('base/feeds', { - parentFolderId: 5, - url: 'ye', + parentFolderId: 0, + url: 'http://hey', title: 'ABC' }).respond(200, {}); - FeedResource.create('ye', 5, 'abc'); + FeedResource.create('hey', undefined, 'abc'); http.flush(); - expect(FeedResource.size()).toBe(3); + expect(FeedResource.get('http://hey').folderId).toBe(0); + expect(FeedResource.get('http://hey').faviconLink).toBe( + '/base/apps/news/css/loading.gif'); })); |