ember test --server
在 ember-cli-addon 项目中运行时,我似乎无法让 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
,以下请求会收到 404 。http://localhost:7357/rest/subManagers
Error: Adapter operation failed
测试正在运行http://localhost:7357/6263/tests/index.html?hidepassed
我究竟做错了什么?