diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-11 11:33:05 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-11 11:33:05 +0200 |
commit | b54b454f8a36e50e46a71a8cc14c5caa59a778e4 (patch) | |
tree | bf51c7f3c4104c89049a9b7165e09f2d4bbdad8d /js/tests/services/models/feedmodelSpec.coffee | |
parent | 50902e1c0550de481fe655c5d560d57da0fe3e12 (diff) |
fixed feedmodel
Diffstat (limited to 'js/tests/services/models/feedmodelSpec.coffee')
-rw-r--r-- | js/tests/services/models/feedmodelSpec.coffee | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/js/tests/services/models/feedmodelSpec.coffee b/js/tests/services/models/feedmodelSpec.coffee index 8c2043a39..1ac76a65e 100644 --- a/js/tests/services/models/feedmodelSpec.coffee +++ b/js/tests/services/models/feedmodelSpec.coffee @@ -52,8 +52,11 @@ describe 'FeedModel', -> item = {faviconLink: null, urlHash: 'hi'} @FeedModel.add(item) + item2 = {faviconLink: null, urlHash: 'his'} + @FeedModel.add(item2) + expect(@FeedModel.getByUrlHash('hi')).toBe(item) - expect(@FeedModel.size()).toBe(1) + expect(@FeedModel.size()).toBe(2) it 'should clear the url hash cache', => @@ -78,16 +81,14 @@ describe 'FeedModel', -> item = {faviconLink: null, urlHash: 'hi', test: 'heheh'} @FeedModel.add(item) - item = {id: 3, faviconLink: null, urlHash: 'hi', test: 'hoho'} - @FeedModel.add(item) - - item = {id: 4, faviconLink: null, urlHash: 'his'} - @FeedModel.add(item) + item2 = {id: 3, faviconLink: null, urlHash: 'hi', test: 'hoho'} + @FeedModel.add(item2) expect(@FeedModel.getByUrlHash('hi').id).toBe(3) + expect(@FeedModel.getByUrlHash('hi').test).toBe('hoho') expect(@FeedModel.getById(3).id).toBe(3) expect(@FeedModel.getById(3).test).toBe('hoho') - expect(@FeedModel.size()).toBe(2) + expect(@FeedModel.size()).toBe(1) it 'should update normally', => @@ -97,8 +98,11 @@ describe 'FeedModel', -> item2 = {id: 3, faviconLink: null, urlHash: 'his', test: 'hoho'} @FeedModel.add(item2) - expect(@FeedModel.getById(3).id).toBe(3) + expect(@FeedModel.getByUrlHash('hi')).toBe(undefined) + expect(@FeedModel.getByUrlHash('his').id).toBe(3) + expect(@FeedModel.getByUrlHash('his').test).toBe('hoho') expect(@FeedModel.getById(3).test).toBe('hoho') expect(@FeedModel.size()).toBe(1) + |