我正在尝试通过验收测试,检查用户是否被重定向。当用户键入URL时,应将其重定向到另一个URL。有人可以告诉我为什么我在控制台上收到此错误?
ember.debug.js:30195 Error while processing route: account.contacts.index Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined
This is my route account/contacts/index.js
import Ember from 'ember';
export default Ember.Route.extend({
redirect: function () {
this.transitionTo('account.contacts.company');
}
});
这是我的帐户/ contacts / index-test.js
moduleForAcceptance('Acceptance | /account/contacts/index');
test('visiting URL', function(assert) {
visit('/account/contacts');
andThen(function() {
assert.equal(currentURL(), '/account/contacts/company');
});
});
在我的测试中,这就是我得到的:
Expected:"/account/contacts/company"
Result: "/account/contacts"