33 lines
866 B
JavaScript
33 lines
866 B
JavaScript
import { mount, flushPromises } from '@vue/test-utils';
|
|
import { installQuasarPlugin } 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,
|
|
},
|
|
});
|
|
|
|
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 };
|