vue-test-functional-wrapper
Install
npm i -D @belsrc/vue-test-functional-wrapper
Use
// functional-component.test.js
import wrapFunctional from '@belsrc/vue-test-functional-wrapper';
import FunctionalComponent from './functional-component';
let wrapped;
describe('FunctionalComponent', () => {
beforeEach(() => {
wrapped = wrapFunctional(FunctionalComponent, {
methods: { click() { this.$emit('click'); } },
on(vm) { return { click: vm.click } },
});
});
describe('Rendering', () => {
test('should do somthing', () => {
const wrapper = mount(wrapped, {
propsData: { foo: 'bar' },
});
...
});
});
});