我正在使用ember-cli / ember-cli-mocha进行测试。当我通过运行应用程序时,我已经生成了可以正常工作的http-mock ember serve
。但是,当我运行测试时(例如,见下文...),出现错误:
Sheet calculates exported fields
✘ Assertion Failed: Unable to find fixtures for model type (subclass of DS.Model). If you're defining your fixtures using `Model.FIXTURES = ...`, please change it to `Model.reopenClass({ FIXTURES: ... })`.
我认为单元测试设置必须将商店设置为使用固定装置。是否有配置可以使用http-mocks代替?
开始测试...
it 'calculates exported fields', ->
# now, exported fields are all fields and variables
expected = `new Set()`
sheet = null
store = @store()
Ember.run ->
store.find('sheet', '1').then( (sheet_)->
sheet = sheet_
Promise.all([ sheet.get('fields'), sheet.get('formulas')])
).then((args)->
[fields, formulas] = args
fields.forEach (f)->expected.add(f)
...
答案在ember-cli主页上:
模仿只是为了发展。在ember构建和ember测试期间,整个/ server目录将被忽略。
但是,Ember.js有附加组件:ember-cli-testem-http-mocks
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句