Merge pull request #1209 from Safelite/defect/CSR-1504

CSR-1504
This commit is contained in:
chloeherdsafelite 2023-07-06 13:54:54 -04:00 committed by GitHub
commit 12deeb8109
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View file

@ -523,6 +523,9 @@ export const getters = {
);
return !!nonWindshieldItems?.length;
},
isMobileAppointment: (state) => {
return state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE;
},
lineItems: (state) => state.order.lineItems,
pageData: (state) => (page) => {
return state.applicationUser.pageData[page];

View file

@ -4,6 +4,7 @@ import { storeMutations } from "@/constants/store-mutations";
import { storeActions } from "@/constants/store-actions";
import { experimentTriggers } from "@/constants/experiments";
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
// Mock global method
globalMethods.callHttpClient = jest.fn();
@ -2869,6 +2870,45 @@ describe("Getters", () => {
expect(getters.payment(storeState).insuranceCoverage.isVerified).toEqual(true);
});
describe("isMobileAppointment", () => {
it("Should return true for mobile appointments", () => {
// Arrange
const storeState = state;
// Act
mutations.updateServiceLocation(storeState, {
appointmentType: AppointmentTypeStrings.MOBILE,
});
// Assert
expect(getters.isMobileAppointment(storeState)).toBe(true);
});
it("Should return false for non-mobile appointments", () => {
// Arrange
const storeState = state;
// Act
mutations.updateServiceLocation(storeState, {
appointmentType: AppointmentTypeStrings.IN_SHOP,
});
// Assert
expect(getters.isMobileAppointment(storeState)).toBe(false);
});
it("Should return false for null appointments", () => {
// Arrange
const storeState = state;
// Act
mutations.updateServiceLocation(storeState, { appointmentType: null });
// Assert
expect(getters.isMobileAppointment(storeState)).toBe(false);
});
});
describe("experimentOrder", () => {
test("glassToReplace, glassParts, and otherParts are null > return correct experimentOrder values", () => {
// Arrange