import vinPagesMixin from '@/mixins/vin-pages-mixin'; import { shallowMount } from '@vue/test-utils'; import { getMountOptions } from '@/helpers/unit-test-helper.js'; import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin'; import { useMainStore } from '@/store'; /** @ignore */ function setupMocks() { const mocks = getMountOptions({ router: { navigate: jest.fn() } }); const mockVinComponent = { mixins: [vinPagesMixin] }; const wrapper = shallowMount(mockVinComponent, mocks); return { wrapper }; } describe('vin-pages-mixin', () => { afterEach(() => { jest.clearAllMocks(); }); describe('navigateForwardWithSingleCarMatch', () => { test('should navigateForward', async () => { // Arrange useMainStore().getPartsOrQuestions = () => ({ data: { partsOrQuestions: {} } }); const { wrapper } = setupMocks({}); vehicleQuestionsMixin.methods.navigateForward = jest.fn(); // Act await wrapper.vm.navigateForwardWithSingleCarMatch(); // Assert expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalled(); }); }); });