我正在使用ember-cli / ember-cli-mocha进行测试。当我通过ember serve
运行我的应用程序时,我生成了http-mock。但是,当我运行我的测试时 - (例如见下文......),我收到错误:
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)
...
答案 0 :(得分:1)
答案在ember-cli主页上:
模拟只是为了发展。整个/服务器目录将是 在ember构建和余烬测试期间被忽略。
但是,Ember.js有一个插件:ember-cli-testem-http-mocks