0
我正在編寫一個非常基本的驗收測試,該測試針對具有管理員權限和非管理員權限的路由。我的測試表明,如果我第一次來到應用程序,我沒有看到登錄功能。在我的應用程序,我使用password
認證如下:無法使用Emberfire模擬會話
this.get('session').open('firebase', {
provider: 'password',
email: email,
password: password
});
我發現,當我沒有在應用程序認證,然後運行驗收試驗,它傳遞。但是,如果我然後登錄應用程序,然後運行測試,我的斷言失敗,因爲會話恢復,當我認爲它不應該。這裏的測試:
import { test } from 'qunit';
import moduleForAcceptance from 'app/tests/helpers/module-for-acceptance';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';
import replaceAppRef from '../helpers/replace-app-ref';
import replaceFirebaseAppService from '../helpers/replace-firebase-app-service';
import stubFirebase from '../helpers/stub-firebase';
import unstubFirebase from '../helpers/unstub-firebase';
import { emptyApplication } from '../helpers/create-test-ref';
moduleForAcceptance('Acceptance | index', {
beforeEach: function() {
stubFirebase();
application = startApp();
replaceFirebaseAppService(application, { });
replaceAppRef(application, emptyApplication());
},
afterEach: function() {
unstubFirebase();
destroyApp(application);
}
});
test('empty app - not authenticated', function(assert) {
visit('/');
andThen(function() {
assert.equal(currentURL(), page.url, 'on the correct page');
// this works if there's no session - fails otherwise
assert.notOk(page.something.isVisible, 'cannot do something');
});
});
我覺得replaceFirebaseAppService
應該重寫torii-adapter
,但它不會出現如此。任何幫助將不勝感激。
我使用:
Ember : 2.7.0
Ember Data : 2.7.0
Firebase : 3.2.1
EmberFire : 2.0.1
jQuery : 2.2.4