diff --git a/src/layouts/capability-questions/capability-questions.spec.js b/src/layouts/capability-questions/capability-questions.spec.js index 2a1e7125..7f970443 100644 --- a/src/layouts/capability-questions/capability-questions.spec.js +++ b/src/layouts/capability-questions/capability-questions.spec.js @@ -8,11 +8,10 @@ import { useMainStore } from '@/store'; import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin'; import { nextTick } from 'vue'; import baseMixin from '@/mixins/base-mixin'; +import settleAllPromises from '@/helpers/layout-helper.js'; // Mock our module for promises. -jest.mock('@/helpers/layout-helper.js', () => ({ - settleAllPromises: jest.fn() -})); +jest.mock('@/helpers/layout-helper.js', () => jest.fn()); // Mock fetchCmsContentForPage jest.mock('@/helpers/cms-content-helper', () => ({ @@ -244,6 +243,7 @@ describe('capabilityQuestions.vue', () => { }); describe('forwardButtonAction', () => { + settleAllPromises.mockImplementation(() => []); test('Should clear out answerData', async () => { // Arrange const { wrapper } = setupMocks({}); @@ -312,7 +312,7 @@ describe('capabilityQuestions.vue', () => { wrapper.unmount(); }); - test('Should call getPartFromCapabilityQuestionAnswer', async () => { + test('Should call updatePartFromCapabilityQuestionAnswer', async () => { // Arrange const { wrapper } = setupMocks({}); @@ -337,14 +337,14 @@ describe('capabilityQuestions.vue', () => { partsOrQuestions: [] } })); - const getPartFromCapabilityQuestionAnswerSpy = jest.spyOn(useMainStore(), 'getPartFromCapabilityQuestionAnswer'); - getPartFromCapabilityQuestionAnswerSpy.mockClear(); + const updatePartFromCapabilityQuestionAnswerSpy = jest.spyOn(useMainStore(), 'updatePartFromCapabilityQuestionAnswer'); + updatePartFromCapabilityQuestionAnswerSpy.mockClear(); // Act await wrapper.vm.forwardButtonAction(); // Assert - expect(getPartFromCapabilityQuestionAnswerSpy).toHaveBeenCalledTimes(1); + expect(updatePartFromCapabilityQuestionAnswerSpy).toHaveBeenCalledTimes(1); wrapper.unmount(); });