summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/service/FeedResourceSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/service/FeedResourceSpec.js')
-rw-r--r--js/tests/unit/service/FeedResourceSpec.js49
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');
}));