mirror of
https://github.com/documize/community.git
synced 2025-07-21 14:19:43 +02:00
Move mirage server create to module-for-acceptance tests file
This commit is contained in:
parent
a74b14ae76
commit
68271646eb
5 changed files with 296 additions and 70 deletions
|
@ -2,31 +2,38 @@ 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();
|
||||
stubAudit(this);
|
||||
stubUserNotification(this);
|
||||
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);
|
||||
|
||||
if (options.beforeEach) {
|
||||
options.beforeEach.apply(this, arguments);
|
||||
}
|
||||
if (options.beforeEach) {
|
||||
options.beforeEach.apply(this, arguments);
|
||||
}
|
||||
|
||||
this.register = (fullName, Factory) => {
|
||||
let instance = this.application.__deprecatedInstance__;
|
||||
let registry = instance.register ? instance : instance.registry;
|
||||
this.register = (fullName, Factory) => {
|
||||
let instance = this.application.__deprecatedInstance__;
|
||||
let registry = instance.register ? instance : instance.registry;
|
||||
|
||||
return registry.register(fullName, Factory);
|
||||
};
|
||||
},
|
||||
return registry.register(fullName, Factory);
|
||||
};
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
destroyApp(this.application);
|
||||
afterEach() {
|
||||
destroyApp(this.application);
|
||||
|
||||
if (options.afterEach) {
|
||||
options.afterEach.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (options.afterEach) {
|
||||
options.afterEach.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue