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,
|
||||
});
|
||||
|
||||
if (result.PartNotFound || store.getters.vehicle.vinRequired) {
|
||||
if (result.PartNotFound) {
|
||||
return bailoutMixin.methods.navigateToBailoutPage(
|
||||
this,
|
||||
bailoutCodes.PART_NOT_FOUND
|
||||
|
|
|
|||
|
|
@ -35,10 +35,9 @@ describe("vin-pages-mixin", () => {
|
|||
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
|
||||
store.commit(storeMutations.UPDATE_VIN_REQUIRED, true);
|
||||
const { wrapper } = setupMocks({});
|
||||
const { wrapper } = setupMocks({ partNotFound: true });
|
||||
bailoutMixin.methods.navigateToBailoutPage = jest.fn();
|
||||
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
||||
|
||||
|
|
@ -52,10 +51,29 @@ describe("vin-pages-mixin", () => {
|
|||
);
|
||||
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({
|
||||
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({
|
||||
router: {
|
||||
navigate: jest.fn(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue