summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-26 18:04:02 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-26 18:04:02 +0100
commitc8d3f8fb4681f6993f1c9389e507df0724f56579 (patch)
tree312b48cdbc17c23d1e7aac6513f40e0a5813fdbf /js/tests
parent8e1e0f5281c1ee49fe7f6d84ba8f2b709ebf7f40 (diff)
added casting information for data objects
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/controllers/feedcontrollerSpec.coffee28
-rw-r--r--js/tests/services/models/feedmodelSpec.coffee2
2 files changed, 18 insertions, 12 deletions
diff --git a/js/tests/controllers/feedcontrollerSpec.coffee b/js/tests/controllers/feedcontrollerSpec.coffee
index af4c8f9a7..8ef621030 100644
--- a/js/tests/controllers/feedcontrollerSpec.coffee
+++ b/js/tests/controllers/feedcontrollerSpec.coffee
@@ -171,7 +171,8 @@ describe '_FeedController', ->
expect(@ActiveFeed.getType()).toBe(4)
- it 'should return true when calling isShown and ShowAll is set to true', =>
+ it 'should return true when calling isShown and there are feeds', =>
+ @FeedModel.add({id: 3})
@ShowAll.setShowAll(true)
expect(@scope.isShown(3, 4)).toBeTruthy()
@@ -340,15 +341,6 @@ describe '_FeedController', ->
expect(@persistence.createFeed).not.toHaveBeenCalled()
- it 'should not add feeds that already exist client side', =>
- @FeedModel.add({id: 3, url: 'ola'})
- @persistence.createFeed = jasmine.createSpy('create')
- @scope.addFeed('ola')
-
- expect(@scope.feedExistsError).toBeTruthy()
- expect(@persistence.createFeed).not.toHaveBeenCalled()
-
-
it 'should set isAddingFeed to true if there were no problems', =>
@persistence.createFeed = jasmine.createSpy('create')
@scope.addFeed('ola')
@@ -358,7 +350,9 @@ describe '_FeedController', ->
it 'should should reset the feedurl and set isAddingFeed to false on succ',=>
@persistence.createFeed =
jasmine.createSpy('create').andCallFake (arg1, arg2, func) =>
- func()
+ data =
+ status: 'success'
+ func(data)
@scope.addFeed(' Ola')
expect(@scope.feedUrl).toBe('')
@@ -375,6 +369,18 @@ describe '_FeedController', ->
expect(@scope.feedError).toBeTruthy()
+ it 'should should set isAddingFeed to false on serverside error',=>
+ @persistence.createFeed =
+ jasmine.createSpy('create').andCallFake (arg1, arg2, func) =>
+ data =
+ status: 'error'
+ func(data)
+ @scope.addFeed('Ola')
+
+ expect(@scope.isAddingFeed()).toBeFalsy()
+ expect(@scope.feedError).toBeTruthy()
+
+
it 'should create a create new feed request if everything was ok', =>
@persistence.createFeed = jasmine.createSpy('create')
@scope.addFeed('Ola')
diff --git a/js/tests/services/models/feedmodelSpec.coffee b/js/tests/services/models/feedmodelSpec.coffee
index 9732d0e82..caddb35c0 100644
--- a/js/tests/services/models/feedmodelSpec.coffee
+++ b/js/tests/services/models/feedmodelSpec.coffee
@@ -36,7 +36,7 @@ describe '_FeedModel', ->
it 'should bind an imagepath to the item if the url is empty', =>
item =
id: 3
- icon: 'url()'
+ faviconLink: null
utils =
imagePath: jasmine.createSpy('utils')