在ember-cli-addon项目中运行ember test --server
时,我似乎无法使用ember-cli-mirage拦截ember-data请求。
/tests/dummy/app/adapters/application.js
export default DS.RESTAdapter.extend({
namespace: 'rest'
});
/tests/dummy/mirage/config.js
export default function() {
this.namespace = '/rest';
this.get('/subManagers', 'sub-manager');
this.get('/subManagers/:id', 'sub-manager');
this.post('/subManagers', 'sub-manager');
this.put('/subManagers/:id', 'sub-manager');
this.del('/subManagers/:id', 'sub-manager');
}
但是,在运行ember test --server
时,以下请求在我的测试请求所有子管理器并且我收到测试错误http://localhost:7357/rest/subManagers
时获得404 Error: Adapter operation failed
。
测试正在http://localhost:7357/6263/tests/index.html?hidepassed
我做错了什么?