Merge pull request #3247 from Safelite/feature/CASH-2943
CASH-2943: Remove bailout for all VinRequired vehicles
This commit is contained in:
commit
4a96e363c2
2 changed files with 31 additions and 5 deletions
|
|
@ -37,7 +37,7 @@ export default {
|
||||||
pageNameToLog: pageName,
|
pageNameToLog: pageName,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.PartNotFound || store.getters.vehicle.vinRequired) {
|
if (result.PartNotFound) {
|
||||||
return bailoutMixin.methods.navigateToBailoutPage(
|
return bailoutMixin.methods.navigateToBailoutPage(
|
||||||
this,
|
this,
|
||||||
bailoutCodes.PART_NOT_FOUND
|
bailoutCodes.PART_NOT_FOUND
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,9 @@ describe("vin-pages-mixin", () => {
|
||||||
expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalled();
|
expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("vinRequired vehicles navigate to bailout after VIN is saved", async () => {
|
test("navigate to bailout when parts are not found", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
store.commit(storeMutations.UPDATE_VIN_REQUIRED, true);
|
const { wrapper } = setupMocks({ partNotFound: true });
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
bailoutMixin.methods.navigateToBailoutPage = jest.fn();
|
bailoutMixin.methods.navigateToBailoutPage = jest.fn();
|
||||||
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
||||||
|
|
||||||
|
|
@ -52,10 +51,29 @@ describe("vin-pages-mixin", () => {
|
||||||
);
|
);
|
||||||
expect(vehicleQuestionsMixin.methods.navigateForward).not.toHaveBeenCalled();
|
expect(vehicleQuestionsMixin.methods.navigateForward).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("vinRequired vehicles navigate forward when parts are found", async () => {
|
||||||
|
// Arrange
|
||||||
|
store.commit(storeMutations.UPDATE_VIN_REQUIRED, true);
|
||||||
|
const partsOrQuestions = [{ partNumber: "123" }];
|
||||||
|
const { wrapper } = setupMocks({ partsOrQuestions });
|
||||||
|
bailoutMixin.methods.navigateToBailoutPage = jest.fn();
|
||||||
|
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.navigateForwardWithSingleCarMatch();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(bailoutMixin.methods.navigateToBailoutPage).not.toHaveBeenCalled();
|
||||||
|
expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalledWith(
|
||||||
|
partsOrQuestions,
|
||||||
|
wrapper.vm
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ partsOrQuestions = [] }) {
|
function setupMocks({ partsOrQuestions = [], partNotFound = false } = {}) {
|
||||||
const baseMixin = setupMocksForJsFiles({
|
const baseMixin = setupMocksForJsFiles({
|
||||||
actionList: [
|
actionList: [
|
||||||
{
|
{
|
||||||
|
|
@ -67,6 +85,14 @@ function setupMocks({ partsOrQuestions = [] }) {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (partNotFound) {
|
||||||
|
baseMixin.baseMixin.methods.dispatchStoreAction.mockImplementation((actionName) => {
|
||||||
|
if (actionName === storeActions.GET_PARTS_OR_QUESTIONS) {
|
||||||
|
return Promise.resolve({ PartNotFound: true });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const mocks = getMountOptions({
|
const mocks = getMountOptions({
|
||||||
router: {
|
router: {
|
||||||
navigate: jest.fn(),
|
navigate: jest.fn(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue