Fixed some tests.

This commit is contained in:
Scott Erickson 2014-08-13 10:48:22 -07:00
parent 04e8680263
commit 19b9a99167
3 changed files with 15 additions and 11 deletions

View file

@ -93,15 +93,15 @@ describe 'LevelLoader', ->
jasmine.Ajax.requests.sendResponses(responses)
requests = jasmine.Ajax.requests.all()
urls = (r.url for r in requests)
expect('/db/thang.type/helmet/version?project=name,components' in urls).toBeTruthy()
expect('/db/thang.type/tharin/version?project=name,components' in urls).toBeTruthy()
expect('/db/thang.type/helmet/version?project=name,components,original' in urls).toBeTruthy()
expect('/db/thang.type/tharin/version?project=name,components,original' in urls).toBeTruthy()
it 'loads components for the hero in the heroConfig in the LevelSession', ->
new LevelLoader({supermodel:new SuperModel(), sessionID: 'id', levelID: 'id'})
responses = {
'/db/level_session/id': sessionWithTharinWithHelmet
'/db/thang.type/tharin/version?project=name,components': thangTypeTharinWithHealsComponent
'/db/thang.type/tharin/version?project=name,components,original': thangTypeTharinWithHealsComponent
}
jasmine.Ajax.requests.sendResponses(responses)
@ -119,7 +119,7 @@ describe 'LevelLoader', ->
jasmine.Ajax.requests.sendResponses(responses)
requests = jasmine.Ajax.requests.all()
urls = (r.url for r in requests)
expect('/db/thang.type/mace/version?project=name,components' in urls).toBeTruthy()
expect('/db/thang.type/mace/version?project=name,components,original' in urls).toBeTruthy()
it 'loads components which are inherited by level thangs from thang type default components', ->
new LevelLoader({supermodel:new SuperModel(), sessionID: 'id', levelID: 'id'})
@ -143,7 +143,7 @@ describe 'LevelLoader', ->
jasmine.Ajax.requests.sendResponses(responses)
requests = jasmine.Ajax.requests.all()
urls = (r.url for r in requests)
expect('/db/thang.type/wand/version?project=name,components' in urls).toBeTruthy()
expect('/db/thang.type/wand/version?project=name,components,original' in urls).toBeTruthy()
it 'loads components for item thang types which are inherited by level thangs from thang type default equips component configs', ->
new LevelLoader({supermodel:new SuperModel(), sessionID: 'id', levelID: 'id'})
@ -151,7 +151,7 @@ describe 'LevelLoader', ->
responses =
'/db/level/id': levelWithShaman
'/db/thang.type/names': [thangTypeShamanWithWandEquipped]
'/db/thang.type/wand/version?project=name,components': thangTypeWand
'/db/thang.type/wand/version?project=name,components,original': thangTypeWand
jasmine.Ajax.requests.sendResponses(responses)
requests = jasmine.Ajax.requests.all()
@ -168,4 +168,4 @@ describe 'LevelLoader', ->
jasmine.Ajax.requests.sendResponses(responses)
requests = jasmine.Ajax.requests.all()
urls = (r.url for r in requests)
expect('/db/thang.type/wand/version?project=name,components' in urls).toBeFalsy()
expect('/db/thang.type/wand/version?project=name,components,original' in urls).toBeFalsy()

View file

@ -25,17 +25,21 @@ componentC = new LevelComponent({
name: 'C (depends on B)'
dependencies: [{original:'B', majorVersion: 0}]
})
componentC.loaded = true
describe 'ThangComponentsEditView', ->
view = null
beforeEach ->
beforeEach (done) ->
supermodel = new SuperModel()
supermodel.registerModel(componentC)
view = new ThangComponentEditView({ components: [], supermodel: supermodel })
view.render()
view.componentsTreema.set('/', [ { original: 'C', majorVersion: 0 }])
spyOn(window, 'noty')
jasmine.Ajax.requests.sendResponses { '/db/thang.type': [] }
_.delay ->
view.render()
view.componentsTreema.set('/', [ { original: 'C', majorVersion: 0 }])
spyOn(window, 'noty')
done()
it 'loads dependencies when you add a component with the left side treema', ->
success = jasmine.Ajax.requests.sendResponses(responses)