diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2013-12-20 22:54:32 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2013-12-20 22:54:32 +0100 |
commit | b5553a83dbd593fa6c7b22e508c3b0fabe1ab9a3 (patch) | |
tree | 46dcda33fc6f943e45e51ce0e26719c2de844a16 /js/tests/services/persistenceSpec.coffee | |
parent | 0454021bc3e65dba6f2509498d0bcff26ff82a6d (diff) |
debug
Diffstat (limited to 'js/tests/services/persistenceSpec.coffee')
-rw-r--r-- | js/tests/services/persistenceSpec.coffee | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/tests/services/persistenceSpec.coffee b/js/tests/services/persistenceSpec.coffee index b9250b974..06bdd73ea 100644 --- a/js/tests/services/persistenceSpec.coffee +++ b/js/tests/services/persistenceSpec.coffee @@ -74,6 +74,42 @@ describe 'Persistence', -> expect(@req.get).toHaveBeenCalledWith('news_items', expected) + it 'should reset the autopage lock when loading a new feed', => + data = + items: [] + called = 0 + @req.get.andCallFake (route, params) -> + params.onSuccess(data) + called++ + + success = -> + @Persistence.getItems(2, 3, 0, success) + @Persistence.getItems(2, 3, 4, success) + @Persistence.getItems(2, 3, 0, success) + @Persistence.getItems(2, 3, 4, success) + + expect(called).toBe(4) + + + xit 'should not send autopage request if reqeust returned nothing', => + data = + items: [] + called = 0 + @req.get.andCallFake (route, params) -> + params.onSuccess(data) + called++ + + success = -> + @Persistence.getItems(2, 3, 4, success) + @Persistence.getItems(2, 3, 4, success) + @Persistence.getItems(2, 3, 4, success) + @Persistence.getItems(2, 3, 0, success) + @Persistence.getItems(2, 3, 0, success) + + expect(called).toBe(3) + + + it 'should send a load new items request', => success = -> params = @@ -446,3 +482,5 @@ describe 'Persistence', -> expect(@req.post).toHaveBeenCalledWith('news_usersettings_setcompact', expected) + + |