salix-front/tests/jest/jestHelpers.js

34 lines
744 B
JavaScript
Raw Normal View History

2022-03-25 14:14:49 +00:00
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 } from 'quasar';
import axios from 'axios';
// Specify here Quasar config you'll need to test your component
installQuasarPlugin({
plugins: {
Notify
}
});
export function createWrapper(component, options) {
const mountOptions = {
2022-03-25 14:14:49 +00:00
global: {
plugins: [i18n]
}
};
if (options instanceof Object)
Object.assign(mountOptions, options)
const wrapper = mount(component, mountOptions);
2022-03-25 14:14:49 +00:00
const vm = wrapper.vm;
return { vm, wrapper };
}
export {
axios,
flushPromises
}