diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-11 20:32:34 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-11 20:32:34 +0200 |
commit | ce6b20c59e1140867f2353361d3524e3baeb4580 (patch) | |
tree | 7671d0e231ef7c2f5098a3b451b524eb536f0faa /js/tests/services | |
parent | a9fb379b370a71f268dd501bc6a4e4d04eacc500 (diff) |
properly clear the query cache
Diffstat (limited to 'js/tests/services')
-rw-r--r-- | js/tests/services/bl/feedblSpec.coffee | 4 | ||||
-rw-r--r-- | js/tests/services/models/feedmodelSpec.coffee | 11 | ||||
-rw-r--r-- | js/tests/services/models/foldermodelSpec.coffee | 20 |
3 files changed, 32 insertions, 3 deletions
diff --git a/js/tests/services/bl/feedblSpec.coffee b/js/tests/services/bl/feedblSpec.coffee index 4b534f998..40441f1b8 100644 --- a/js/tests/services/bl/feedblSpec.coffee +++ b/js/tests/services/bl/feedblSpec.coffee @@ -309,4 +309,6 @@ describe 'FeedBl', -> expect(onFailure).toHaveBeenCalled() expect(@FeedModel.getByUrlHash(hex_md5('johns')).error).toBe( - @response.msg)
\ No newline at end of file + @response.msg) + + diff --git a/js/tests/services/models/feedmodelSpec.coffee b/js/tests/services/models/feedmodelSpec.coffee index 1ac76a65e..c73c2149d 100644 --- a/js/tests/services/models/feedmodelSpec.coffee +++ b/js/tests/services/models/feedmodelSpec.coffee @@ -105,4 +105,15 @@ describe 'FeedModel', -> expect(@FeedModel.size()).toBe(1) + it 'should clear invalidate the query cache on adding folder with name', => + item = {faviconLink: null, urlHash: 'hi', test: 'heheh', folderId: 0} + + expect(@FeedModel.getAllOfFolder(0).length).toBe(0) + @FeedModel.add(item, false) + + expect(@FeedModel.getAllOfFolder(0).length).toBe(0) + + item2 = {faviconLink: null, urlHash: 'his', test: 'heheh', folderId: 0} + @FeedModel.add(item2) + expect(@FeedModel.getAllOfFolder(0).length).toBe(2)
\ No newline at end of file diff --git a/js/tests/services/models/foldermodelSpec.coffee b/js/tests/services/models/foldermodelSpec.coffee index d34b2e309..04bf02000 100644 --- a/js/tests/services/models/foldermodelSpec.coffee +++ b/js/tests/services/models/foldermodelSpec.coffee @@ -25,7 +25,7 @@ describe 'FolderModel', -> beforeEach module 'News' - beforeEach inject (@FolderModel, @_Model) => + beforeEach inject (@FolderModel, @_Model, @_EqualQuery) => it 'should extend model', => @@ -93,4 +93,20 @@ describe 'FolderModel', -> expect(@FolderModel.getByName('Hobo').id).toBe(3) expect(@FolderModel.getByName('Hobo').test).toBe('hoho') expect(@FolderModel.getById(3).test).toBe('hoho') - expect(@FolderModel.size()).toBe(1)
\ No newline at end of file + expect(@FolderModel.size()).toBe(1) + + + + it 'should clear invalidate the query cache on adding folder with name', => + item = {name: 'name1', test: 'hi'} + query = new @_EqualQuery('test', 'hi') + + expect(@FolderModel.get(query).length).toBe(0) + @FolderModel.add(item, false) + + expect(@FolderModel.get(query).length).toBe(0) + + item2 = {name: 'name', test: 'hi'} + @FolderModel.add(item2) + + expect(@FolderModel.get(query).length).toBe(2)
\ No newline at end of file |