diff options
Diffstat (limited to 'js/tests/unit')
-rw-r--r-- | js/tests/unit/controller/NavigationControllerSpec.js | 29 | ||||
-rw-r--r-- | js/tests/unit/service/FeedResourceSpec.js | 12 |
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'); })); |