summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-12 03:03:44 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-12 03:03:44 +0200
commit761412ebaaf0930499ca26e7acdd0965be5a50ae (patch)
tree24c62f2b64e12d92e339c16f96fb1f01dae7972c /js/tests
parent1a04a1c73540be7c7294ef86b92df65bd91c5fc8 (diff)
create folders!
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js10
-rw-r--r--js/tests/unit/service/FeedResourceSpec.js49
-rw-r--r--js/tests/unit/service/FolderResourceSpec.js2
3 files changed, 34 insertions, 27 deletions
diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js
index 23f1b3522..87b45e94c 100644
--- a/js/tests/unit/controller/NavigationControllerSpec.js
+++ b/js/tests/unit/controller/NavigationControllerSpec.js
@@ -287,7 +287,15 @@ describe('NavigationController', function () {
FolderResource) {
expect(controller.folderNameExists('hi')).toBe(false);
FolderResource.add({name: 'hi'});
- expect(controller.folderNameExists('hi')).toBe(true);
+ expect(controller.folderNameExists(' hi ')).toBe(true);
+ }));
+
+ it('should expose check if a feed url exists', inject(function (
+ FeedResource) {
+ expect(controller.feedUrlExists('hi')).toBe(false);
+ FeedResource.add({url: 'http://hi'});
+ expect(controller.feedUrlExists('hi ')).toBe(true);
+ expect(controller.feedUrlExists('http://hi')).toBe(true);
}));
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');
}));
diff --git a/js/tests/unit/service/FolderResourceSpec.js b/js/tests/unit/service/FolderResourceSpec.js
index 7c8cd52dd..6d3e73799 100644
--- a/js/tests/unit/service/FolderResourceSpec.js
+++ b/js/tests/unit/service/FolderResourceSpec.js
@@ -77,7 +77,7 @@ describe('FolderResource', function () {
folderName: 'hey'
}).respond(200, {});
- FolderResource.create('hey');
+ FolderResource.create(' hey ');
http.flush();