1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 14:49:42 +02:00
documize/app/tests/helpers/module-for-acceptance.js

40 lines
1 KiB
JavaScript
Raw Normal View History

2016-07-07 18:54:16 -07:00
import { module } from 'qunit';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';
export default function (name, options = {}) {
module(name, {
beforeEach() {
this.application = startApp();
localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
stubAudit(this);
stubUserNotification(this);
server.createList('folder', 2);
server.createList('user', 2);
server.createList('document', 2);
server.createList('permission', 4);
server.createList('folder-permission', 2);
server.createList('organization', 1);
2016-07-07 18:54:16 -07:00
if (options.beforeEach) {
options.beforeEach.apply(this, arguments);
}
2016-07-07 18:54:16 -07:00
this.register = (fullName, Factory) => {
let instance = this.application.__deprecatedInstance__;
let registry = instance.register ? instance : instance.registry;
2016-07-07 18:54:16 -07:00
return registry.register(fullName, Factory);
};
},
2016-07-07 18:54:16 -07:00
afterEach() {
destroyApp(this.application);
2016-07-07 18:54:16 -07:00
if (options.afterEach) {
options.afterEach.apply(this, arguments);
}
}
});
2016-07-07 18:54:16 -07:00
}