While testing project in vue js with jest. My code coverage was more than 90% before code converting into vuex but after converting code into vuex I got the following errors. help me for solving that issue
My mealDetails component as follow:
`
{{ mealDetails.strMeal }}
Ingredients
Measures
{{ key }}
{{ value }}
Instructions
{{ mealDetails.strInstructions }}
`
``
My myDetails.spec.js is as follows:
`import { shallowMount, createLocalVue } from '@vue/test-utils'
import MealDetails from '@/components/MealDetails.vue'
import BootstrapVue from 'bootstrap-vue'
import Vuex from 'vuex';
describe('in a MealDetails component', () => {
let wrapper;
it('is a vue instance', () => {
expect(wrapper.isVueInstance).toBeTruthy();
});
it('should render the correct markup', () => {
expect(wrapper.html()).toContain('
');
});
it('should render the correct p tag', () => {
expect(wrapper.html()).toContain('
');
});
it('getMealDetailsById action should be called on calling getMealDetailsById method', () => {
wrapper.vm.getMealDetailsById('52856');
expect(actions.getMealDetailsById).toHaveBeenCalled();
});
While testing project in vue js with jest. My code coverage was more than 90% before code converting into vuex but after converting code into vuex I got the following errors. help me for solving that issue
My mealDetails component as follow:
`
{{ mealDetails.strMeal }}
Instructions
{{ mealDetails.strInstructions }}
`
``
My myDetails.spec.js is as follows:
`import { shallowMount, createLocalVue } from '@vue/test-utils' import MealDetails from '@/components/MealDetails.vue' import BootstrapVue from 'bootstrap-vue' import Vuex from 'vuex';
describe('in a MealDetails component', () => { let wrapper;
const state = { mealDetails: { strMeal:'Sugar Pie', strMealThumb:'https://www.themealdb.com/images/media/meals/yrstur1511816601.jpg', strCategory:'Dessert', strArea:'Canadian', idMeal:'52931', }, };
const actions = { getMealDetailsById: jest.fn(), }; beforeEach(() => { const localVue = createLocalVue(); localVue.use(BootstrapVue); localVue.use(Vuex);
});
afterEach(() => { wrapper.destroy(); });
it('is a vue instance', () => { expect(wrapper.isVueInstance).toBeTruthy(); });
it('should render the correct markup', () => { expect(wrapper.html()).toContain('
'); }); it('getMealDetailsById action should be called on calling getMealDetailsById method', () => { wrapper.vm.getMealDetailsById('52856'); expect(actions.getMealDetailsById).toHaveBeenCalled(); });
});`
no one is here for solving this issue