我遇到了升级ember simple auth的问题。
TypeError: Cannot read property '__container__' of undefined
at authenticateSession (http://app.meetabe.dev:4200/assets/tests-a3c931e27860232e47d8de67d537cf75.js:298:24)
at Object.<anonymous> (http://app.meetabe.dev:4200/assets/tests-a3c931e27860232e47d8de67d537cf75.js:90:61)
我已使用以下方法正确导入了新的辅助方法:
import { authenticateSession } from '../helpers/ember-simple-auth';
对于我需要做些什么才能让它发挥作用?
这是我的测试,试图访问经过验证的路线。
import { test } from 'qunit';
import moduleForAcceptance from '../helpers/module-for-acceptance';
import { authenticateSession } from '../helpers/ember-simple-auth';
moduleForAcceptance('Acceptance | overview');
test('visiting /overview', function(assert) {
authenticateSession();
visit('/overview');
andThen(function() {
assert.equal(currentURL(), '/overview');
});
});
答案 0 :(得分:1)
将App传递给authenticateSession方法
import startApp from '../helpers/start-app';
let App;
moduleForAcceptance('Acceptance | home', {
beforeEach() {
App = startApp();
},
afterEach() {
Ember.run(App, App.destroy);
}
});
test('visiting /overview', function(assert) {
authenticateSession(App);
...
});