diff --git a/src/mixins/vin-pages-mixin.spec.js b/src/mixins/vin-pages-mixin.spec.js index fab447e7..9a84e383 100644 --- a/src/mixins/vin-pages-mixin.spec.js +++ b/src/mixins/vin-pages-mixin.spec.js @@ -1,6 +1,11 @@ import vinPagesMixin from '@/mixins/vin-pages-mixin'; import { shallowMount } from '@vue/test-utils'; import { getMountOptions } from '@/helpers/unit-test-helper.js'; +import { + hasYMMExperimentSettingEnabled, + hasYMMExperimentBailoutSettingEnabled, + hasYMMExperimentPageSettingEnabled, +} from '@/helpers/vehicle-helper'; import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin'; import { useMainStore } from '@/store'; import experimentMixin from '@/mixins/experiment-mixin'; @@ -16,6 +21,11 @@ jest.mock('@/mixins/experiment-mixin', () => ({ hasSettingEqualTo: jest.fn(), } })); +jest.mock('@/helpers/vehicle-helper', () => ({ + hasYMMExperimentSettingEnabled: jest.fn(), + hasYMMExperimentBailoutSettingEnabled: jest.fn(), + hasYMMExperimentPageSettingEnabled: jest.fn(), +})); /** @ignore */ function setupMocks() { const mocks = getMountOptions({ @@ -72,7 +82,9 @@ describe('vin-pages-mixin', () => { test('should bailout if bailout experiment setting is true', async () => { // Arrange useMainStore().order.vehicle.vinRequired = true; - experimentMixin.methods.hasSettingEqualTo = jest.fn().mockReturnValue(true); + hasYMMExperimentSettingEnabled.mockReturnValue(true); + hasYMMExperimentBailoutSettingEnabled.mockReturnValue(true); + hasYMMExperimentPageSettingEnabled.mockReturnValue(false); const { wrapper } = setupMocks({}); // Act @@ -85,8 +97,11 @@ describe('vin-pages-mixin', () => { test('should navigateBailout when parts not found', async () => { // Arrange - vehicleQuestionsMixin.methods.getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [] } }); + useMainStore().getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [] } }); useMainStore().order.vehicle.vinRequired = true; + hasYMMExperimentSettingEnabled.mockReturnValue(true); + hasYMMExperimentBailoutSettingEnabled.mockReturnValue(false); + hasYMMExperimentPageSettingEnabled.mockReturnValue(true); const { wrapper } = setupMocks({}); // Act @@ -100,8 +115,11 @@ describe('vin-pages-mixin', () => { test('should navigate next when parts found', async () => { // Arrange useMainStore().order.vehicle.vinRequired = true; + hasYMMExperimentSettingEnabled.mockReturnValue(true); + hasYMMExperimentBailoutSettingEnabled.mockReturnValue(false); + hasYMMExperimentPageSettingEnabled.mockReturnValue(true); experimentMixin.methods.hasSettingEqualTo = jest.fn().mockReturnValue(false); - vehicleQuestionsMixin.methods.getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [{}] } }); + useMainStore().getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [{}] } }); vehicleQuestionsMixin.methods.navigateForward = jest.fn(); const { wrapper } = setupMocks({});