summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-12 05:28:09 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-12 05:28:09 +0200
commitcc1dc2ed30486780f7ac46141c731dfe2da8e2de (patch)
tree46525f7898928fbfffa13b9e1f08754b68fd5e88 /js/tests
parent2c161c47ece07732b0cd1a5a0ea9e8f25bf44441 (diff)
working on creating folders
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/unit/controller/NavigationControllerSpec.js29
-rw-r--r--js/tests/unit/service/FeedResourceSpec.js12
2 files changed, 24 insertions, 17 deletions
diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js
index cfa2a8557..eced39425 100644
--- a/js/tests/unit/controller/NavigationControllerSpec.js
+++ b/js/tests/unit/controller/NavigationControllerSpec.js
@@ -326,12 +326,14 @@ describe('NavigationController', function () {
var ctrl = $controller('NavigationController', {
FeedResource: FeedResource,
Publisher: Publisher,
- $location: location
+ $location: location,
});
var feed = {
url: 'test',
- folderId: 3
+ folderId: {
+ id: 3
+ }
};
ctrl.createFeed(feed);
@@ -345,6 +347,7 @@ describe('NavigationController', function () {
folderId: 3
}]});
expect(feed.url).toBe('');
+ expect(feed.folderId.id).toBe(3);
expect(location.path).toHaveBeenCalledWith('/items/feeds/3');
}));
@@ -372,7 +375,10 @@ describe('NavigationController', function () {
return {
then: function (callback) {
callback({
- name: folder
+ folders: [{
+ name: folder,
+ id: 19
+ }]
});
}
};
@@ -397,20 +403,23 @@ describe('NavigationController', function () {
ctrl.createFeed(feed);
expect(ctrl.newFolder).toBe(false);
- expect(FeedResource.create).toHaveBeenCalledWith('test', 'john',
+ expect(FeedResource.create).toHaveBeenCalledWith('test', 19,
undefined);
expect(FolderResource.create).toHaveBeenCalledWith('john');
+ expect(Publisher.publishAll).toHaveBeenCalledWith({
+ folders: [{
+ name: 'john',
+ id: 19
+ }]
+ });
expect(Publisher.publishAll).toHaveBeenCalledWith({feeds:[{
id: 2,
url: 'test',
- folderId: 'john'
+ folderId: 19
}]});
- expect(Publisher.publishAll).toHaveBeenCalledWith({
- name: 'john'
- });
expect(feed.url).toBe('');
- expect(feed.folder).toBe('');
- expect(feed.folderId).toBe('john');
+ expect(feed.folderId.getsFeed).toBe(undefined);
+ expect(feed.folderId.id).toBe(19);
}));
diff --git a/js/tests/unit/service/FeedResourceSpec.js b/js/tests/unit/service/FeedResourceSpec.js
index 0878a4954..5433626e8 100644
--- a/js/tests/unit/service/FeedResourceSpec.js
+++ b/js/tests/unit/service/FeedResourceSpec.js
@@ -156,7 +156,7 @@ describe('FeedResource', function () {
http.expectPOST('base/feeds', {
parentFolderId: 5,
url: 'http://hey',
- title: 'ABC'
+ title: 'abc'
}).respond(200, {});
FeedResource.create(' hey ', 5, ' abc');
@@ -171,7 +171,7 @@ describe('FeedResource', function () {
http.expectPOST('base/feeds', {
parentFolderId: 5,
url: 'http://hey',
- title: 'ABC'
+ title: 'abc'
}).respond(200, {});
FeedResource.create('http://hey', 5, 'abc');
@@ -186,7 +186,7 @@ describe('FeedResource', function () {
http.expectPOST('base/feeds', {
parentFolderId: 5,
url: 'https://hey',
- title: 'ABC'
+ title: 'abc'
}).respond(400, {message: 'noo'});
FeedResource.create('https://hey', 5, 'abc');
@@ -202,16 +202,14 @@ describe('FeedResource', function () {
http.expectPOST('base/feeds', {
parentFolderId: 0,
url: 'http://hey',
- title: 'ABC'
+ title: 'http://hey'
}).respond(200, {});
- FeedResource.create('hey', undefined, 'abc');
+ FeedResource.create('hey', undefined);
http.flush();
expect(FeedResource.get('http://hey').folderId).toBe(0);
- expect(FeedResource.get('http://hey').faviconLink).toBe(
- '/base/apps/news/css/loading.gif');
}));