summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-05-10 16:15:53 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-05-10 16:15:53 +0200
commit0f56370f8c0930621a2fe458536f9d7a8d9a296a (patch)
tree92a996e7f1c20eab83ac41f72184536318e43fbc /js
parent3843f75b494bd8f612dc7b940a1d9b331d70f581 (diff)
fixed tests for delete
Diffstat (limited to 'js')
-rw-r--r--js/tests/services/businesslayer/feedbusinesslayerSpec.coffee13
-rw-r--r--js/tests/services/businesslayer/folderbusinesslayerSpec.coffee11
2 files changed, 18 insertions, 6 deletions
diff --git a/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
index 42cab53b1..61342f317 100644
--- a/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
+++ b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee
@@ -45,22 +45,27 @@ describe 'FeedBusinessLayer', ->
beforeEach inject (@FeedBusinessLayer, @FeedModel, @ItemModel, @FeedType,
@ShowAll, @ActiveFeed, @_ExistsError, @$timeout,
- @NewestItem) =>
+ @NewestItem, @$rootScope) =>
@ShowAll.setShowAll(false)
@ActiveFeed.handle({type: @FeedType.Folder, id:0})
+
it 'should delete feeds', =>
+ data = null
+ @$rootScope.$on 'undoMessage', (scope, data) ->
+ data = data
+
@FeedModel.removeById = jasmine.createSpy('remove').andCallFake ->
return {id: 3, title: 'test'}
@persistence.deleteFeed = jasmine.createSpy('deletequery')
@FeedBusinessLayer.delete(3)
expect(@FeedModel.removeById).toHaveBeenCalledWith(3)
-
- @$timeout.flush()
-
expect(@persistence.deleteFeed).toHaveBeenCalledWith(3)
+ #expect(data.caption).toBe('test')
+ # TODO: test for correct undocallbacks
+
it 'should return the number of unread feeds', =>
@FeedModel.add({id: 3, unreadCount:134, url: 'a1'})
diff --git a/js/tests/services/businesslayer/folderbusinesslayerSpec.coffee b/js/tests/services/businesslayer/folderbusinesslayerSpec.coffee
index c0ea2aedb..2cda7b08c 100644
--- a/js/tests/services/businesslayer/folderbusinesslayerSpec.coffee
+++ b/js/tests/services/businesslayer/folderbusinesslayerSpec.coffee
@@ -40,12 +40,16 @@ describe 'FolderBusinessLayer', ->
beforeEach inject (@FolderBusinessLayer, @FolderModel, @FeedModel, @ShowAll,
@ActiveFeed, @FeedType, @_ExistsError, @$timeout,
- @NewestItem, @ItemModel) =>
+ @NewestItem, @ItemModel, @$rootScope) =>
@ShowAll.setShowAll(false)
@ActiveFeed.handle({type: @FeedType.Feed, id:0})
it 'should delete folders', =>
+ data = null
+ @$rootScope.$on 'undoMessage', (scope, data) ->
+ data = data
+
@FeedModel.add({id: 5, unreadCount:2, folderId: 3, url: 'a1'})
@FolderModel.removeById = jasmine.createSpy('remove').andCallFake ->
return {id: 3, name: 'test'}
@@ -54,12 +58,15 @@ describe 'FolderBusinessLayer', ->
@persistence.deleteFolder = jasmine.createSpy('deletequery')
@FolderBusinessLayer.delete(3)
- @$timeout.flush()
expect(@FolderModel.removeById).toHaveBeenCalledWith(3)
expect(@FeedModel.removeById).toHaveBeenCalledWith(5)
expect(@persistence.deleteFolder).toHaveBeenCalledWith(3)
+ #expect(data.caption).toBe('test')
+ # TODO: test for correct undocallbacks
+
+
it 'should return true when folder has feeds', =>
@FeedModel.add({id: 5, unreadCount:2, folderId: 2, url: 'a1'})