fix test
This commit is contained in:
parent
48aa306498
commit
a4ed7ff75d
1 changed files with 21 additions and 3 deletions
|
|
@ -1,6 +1,11 @@
|
||||||
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
import vinPagesMixin from '@/mixins/vin-pages-mixin';
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from '@vue/test-utils';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
|
import {
|
||||||
|
hasYMMExperimentSettingEnabled,
|
||||||
|
hasYMMExperimentBailoutSettingEnabled,
|
||||||
|
hasYMMExperimentPageSettingEnabled,
|
||||||
|
} from '@/helpers/vehicle-helper';
|
||||||
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
import vehicleQuestionsMixin from '@/mixins/vehicle-questions-mixin';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
import experimentMixin from '@/mixins/experiment-mixin';
|
import experimentMixin from '@/mixins/experiment-mixin';
|
||||||
|
|
@ -16,6 +21,11 @@ jest.mock('@/mixins/experiment-mixin', () => ({
|
||||||
hasSettingEqualTo: jest.fn(),
|
hasSettingEqualTo: jest.fn(),
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
jest.mock('@/helpers/vehicle-helper', () => ({
|
||||||
|
hasYMMExperimentSettingEnabled: jest.fn(),
|
||||||
|
hasYMMExperimentBailoutSettingEnabled: jest.fn(),
|
||||||
|
hasYMMExperimentPageSettingEnabled: jest.fn(),
|
||||||
|
}));
|
||||||
/** @ignore */
|
/** @ignore */
|
||||||
function setupMocks() {
|
function setupMocks() {
|
||||||
const mocks = getMountOptions({
|
const mocks = getMountOptions({
|
||||||
|
|
@ -72,7 +82,9 @@ describe('vin-pages-mixin', () => {
|
||||||
test('should bailout if bailout experiment setting is true', async () => {
|
test('should bailout if bailout experiment setting is true', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
useMainStore().order.vehicle.vinRequired = true;
|
useMainStore().order.vehicle.vinRequired = true;
|
||||||
experimentMixin.methods.hasSettingEqualTo = jest.fn().mockReturnValue(true);
|
hasYMMExperimentSettingEnabled.mockReturnValue(true);
|
||||||
|
hasYMMExperimentBailoutSettingEnabled.mockReturnValue(true);
|
||||||
|
hasYMMExperimentPageSettingEnabled.mockReturnValue(false);
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -85,8 +97,11 @@ describe('vin-pages-mixin', () => {
|
||||||
|
|
||||||
test('should navigateBailout when parts not found', async () => {
|
test('should navigateBailout when parts not found', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
vehicleQuestionsMixin.methods.getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [] } });
|
useMainStore().getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [] } });
|
||||||
useMainStore().order.vehicle.vinRequired = true;
|
useMainStore().order.vehicle.vinRequired = true;
|
||||||
|
hasYMMExperimentSettingEnabled.mockReturnValue(true);
|
||||||
|
hasYMMExperimentBailoutSettingEnabled.mockReturnValue(false);
|
||||||
|
hasYMMExperimentPageSettingEnabled.mockReturnValue(true);
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -100,8 +115,11 @@ describe('vin-pages-mixin', () => {
|
||||||
test('should navigate next when parts found', async () => {
|
test('should navigate next when parts found', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
useMainStore().order.vehicle.vinRequired = true;
|
useMainStore().order.vehicle.vinRequired = true;
|
||||||
|
hasYMMExperimentSettingEnabled.mockReturnValue(true);
|
||||||
|
hasYMMExperimentBailoutSettingEnabled.mockReturnValue(false);
|
||||||
|
hasYMMExperimentPageSettingEnabled.mockReturnValue(true);
|
||||||
experimentMixin.methods.hasSettingEqualTo = jest.fn().mockReturnValue(false);
|
experimentMixin.methods.hasSettingEqualTo = jest.fn().mockReturnValue(false);
|
||||||
vehicleQuestionsMixin.methods.getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [{}] } });
|
useMainStore().getPartsOrQuestionsV2 = () => ({ data: { partsOrQuestions: [{}] } });
|
||||||
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue