我正在尝试通过验收测试来检查用户是否被重定向。当用户键入一个 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');
}
});
这是我的帐户/联系人/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"