I have few unit tests for a Vue component. In most of the tests, the shallowMounted component just need computed properties. But for two test I need a store(Vuex) instance. Is there a way to add instances to the already shallowMounted component? May be code below will help to understand. Its just an example. Thank you.
describe(('Vue component test') => {
beforeEach(() => {
wrapper = shallowMount(Component, {
computed: {
errors: () => null,
isLoading: () => false,
}
})
});
describe('Test 1', => {
it('is a vue instance', () => {
expect(wrapper...);
});
});
describe('Test 2' => {
it('is a vue component', () => {
expect(wrapper...);
});
})
describe('Test with store instance', {
// Add store(Vuex) instance to the `wrapper` defined inside beforeEach() above
// Then use the wrapper
expect(wrapper...);
});
});