34 lines
898 B
JavaScript
34 lines
898 B
JavaScript
import { mount, flushPromises } from '@vue/test-utils';
|
|
import { installQuasarPlugin, installRouter } from '@quasar/quasar-app-extension-testing-unit-jest';
|
|
import { i18n } from 'src/boot/i18n';
|
|
import { Notify, Dialog } from 'quasar';
|
|
import axios from 'axios';
|
|
|
|
installQuasarPlugin({
|
|
plugins: {
|
|
Notify,
|
|
Dialog,
|
|
},
|
|
});
|
|
installRouter();
|
|
|
|
export function createWrapper(component, options) {
|
|
const mountOptions = {};
|
|
|
|
if (options instanceof Object) Object.assign(mountOptions, options);
|
|
|
|
if (mountOptions.global && mountOptions.global.plugins) {
|
|
mountOptions.global.plugins.push(i18n);
|
|
} else {
|
|
if (!mountOptions.global) mountOptions.global = {};
|
|
mountOptions.global.plugins = [i18n];
|
|
}
|
|
|
|
const wrapper = mount(component, mountOptions);
|
|
const vm = wrapper.vm;
|
|
|
|
return { vm, wrapper };
|
|
}
|
|
|
|
export { axios, flushPromises };
|