1107798da6
Generated with a codemode: https://github.com/ember-cli/ember-modules-codemod
28 lines
787 B
JavaScript
28 lines
787 B
JavaScript
import { Promise } from 'rsvp';
|
|
import { module } from 'qunit';
|
|
import startApp from '../helpers/start-app';
|
|
import destroyApp from '../helpers/destroy-app';
|
|
|
|
export default function(name, options = {}) {
|
|
module(name, {
|
|
beforeEach() {
|
|
// Clear session storage (a side effect of token storage)
|
|
window.sessionStorage.clear();
|
|
|
|
// Also clear local storage (a side effect of namespaces)
|
|
window.localStorage.clear();
|
|
|
|
this.application = startApp();
|
|
|
|
if (options.beforeEach) {
|
|
return options.beforeEach.apply(this, arguments);
|
|
}
|
|
},
|
|
|
|
afterEach() {
|
|
let afterEach = options.afterEach && options.afterEach.apply(this, arguments);
|
|
return Promise.resolve(afterEach).then(() => destroyApp(this.application));
|
|
},
|
|
});
|
|
}
|