Merge pull request #2326 from Safelite/rlsmerge/2025.02.27-to-develop

Rlsmerge/2025.02.27 to develop
This commit is contained in:
CarlNation 2025-02-24 09:43:14 -05:00 committed by GitHub
commit 1ecd0b4a83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 155 additions and 88 deletions

View file

@ -258,7 +258,7 @@ export default {
min-height: 52px;
max-height: 126px;
@include media-breakpoint-up(md) {
max-height: 500px;
max-height: 500px;
}
transition: max-height 0.25s ease-in;

View file

@ -361,13 +361,16 @@ export default {
if (!this.customerQuestions.emailOrSms) {
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
}
else {
} else {
if (vinPagesMixin.methods.isPhoneNumber(this.customerQuestions.emailOrSms)) {
const phone = this.customerQuestions.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
} else {
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.customerQuestions.emailOrSms, false);
await this.dispatchStoreAction(
storeActions.SAVE_EMAIL,
this.customerQuestions.emailOrSms,
false
);
}
}

View file

@ -1,105 +1,102 @@
import { shallowMount } from '@vue/test-utils';
import InsuranceCompany from '@/layouts/insurance-company/insurance-company.vue';
import { applicationConfig } from '@/constants/application-config.js';
import { shallowMount } from "@vue/test-utils";
import InsuranceCompany from "@/layouts/insurance-company/insurance-company.vue";
import { applicationConfig } from "@/constants/application-config.js";
import store from "@/store";
import baseMixin from "@/mixins/base-mixin.js";
jest.mock('@/store', () => ({
jest.mock("@/store", () => ({
getters: {
order: {
payment: {
parentAccountNumber: '12345',
order: {
payment: {
parentAccountNumber: "12345",
},
},
},
},
}));
}));
var mockRouter = {
navigateWithoutSaving: jest.fn(),
};
};
jest.mock('@/mixins/base-mixin.js', () => ({
jest.mock("@/mixins/base-mixin.js", () => ({
methods: {
navigateWithoutSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
data() {
return {
navigationScenarios: {
CLICKED_BACK: 'clicked_back',
},
};
return {
navigationScenarios: {
CLICKED_BACK: "clicked_back",
},
};
},
}));
}));
describe("insurance-company.vue", () => {
beforeEach(() => {
// Reset the store's parentAccountNumber before each test
store.getters.order.payment.parentAccountNumber = '12345';
});
store.getters.order.payment.parentAccountNumber = "12345";
});
test('should return true when parentAccountNumber matches CASH_PARENT_ACCOUNT_NUMBER', () => {
test("should return true when parentAccountNumber matches CASH_PARENT_ACCOUNT_NUMBER", () => {
applicationConfig.CASH_PARENT_ACCOUNT_NUMBER = "12345";
const wrapper = shallowMount(InsuranceCompany, {
global: {
mocks: {
$store: store
},
},
});
expect(wrapper.vm.isCashParentAccountNumber()).toBe(true);
});
test('should return false when parentAccountNumber does not match CASH_PARENT_ACCOUNT_NUMBER', () => {
applicationConfig.CASH_PARENT_ACCOUNT_NUMBER = "12345";
store.getters.order.payment.parentAccountNumber = '67890';
const wrapper = shallowMount(InsuranceCompany, {
global: {
mocks: {
$store: store,
},
},
});
expect(wrapper.vm.isCashParentAccountNumber()).toBe(false);
});
test('should call navigateWithoutSaving with { isCashSelected: true } when forceCashSelection is true', () => {
const wrapper = shallowMount(InsuranceCompany, {
global: {
mocks: {
$store: store,
$router: mockRouter,
},
mixins: [baseMixin],
mocks: {
$store: store,
},
},
});
});
expect(wrapper.vm.isCashParentAccountNumber()).toBe(true);
});
test("should return false when parentAccountNumber does not match CASH_PARENT_ACCOUNT_NUMBER", () => {
applicationConfig.CASH_PARENT_ACCOUNT_NUMBER = "12345";
store.getters.order.payment.parentAccountNumber = "67890";
const wrapper = shallowMount(InsuranceCompany, {
global: {
mocks: {
$store: store,
},
},
});
expect(wrapper.vm.isCashParentAccountNumber()).toBe(false);
});
test("should call navigateWithoutSaving with { isCashSelected: true } when forceCashSelection is true", () => {
const wrapper = shallowMount(InsuranceCompany, {
global: {
mocks: {
$store: store,
$router: mockRouter,
},
mixins: [baseMixin],
},
});
wrapper.vm.backButtonAction(true);
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
wrapper.vm.navigationScenarios.CLICKED_BACK,
wrapper.vm.$route,
{ isCashSelected: true }
wrapper.vm.navigationScenarios.CLICKED_BACK,
wrapper.vm.$route,
{ isCashSelected: true }
);
});
test('should call navigateWithoutSaving with no extra parameter when forceCashSelection is false', () => {
});
test("should call navigateWithoutSaving with no extra parameter when forceCashSelection is false", () => {
const wrapper = shallowMount(InsuranceCompany, {
global: {
mocks: {
$store: store,
$router: mockRouter,
mocks: {
$store: store,
$router: mockRouter,
},
mixins: [baseMixin],
},
mixins: [baseMixin],
},
});
});
wrapper.vm.backButtonAction(false);
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
wrapper.vm.navigationScenarios.CLICKED_BACK,
wrapper.vm.$route
wrapper.vm.navigationScenarios.CLICKED_BACK,
wrapper.vm.$route
);
});
});
});

View file

@ -315,8 +315,7 @@ export default {
if (!this.emailOrSms) {
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
}
else {
} else {
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
const phone = this.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);

View file

@ -59,6 +59,9 @@ jest.mock("@/mixins/base-mixin", () => ({
filterOutFees(items) {
return null;
},
filterOutServicePackageDiscountPart(items) {
return null;
},
isFormValid(form) {
return true;
},

View file

@ -361,16 +361,28 @@ export default {
)
: baseMixin.methods.filterOutFees(availableLineItems);
const lineItemsNoDiscount =
baseMixin.methods.filterOutServicePackageDiscountPart(
lineItemsForCalculatingPrice
);
if (isInsuranceFromQueryString != null) {
if (isInsuranceFromQueryString.toLowerCase() === "true") {
return true;
}
}
return (
baseMixin.methods.getTierOnePackagePrice(lineItemsForCalculatingPrice) >
insuranceThreshold
); // compare base price vs arbitrary threshold (representing insurance price)
const tierOnePrice =
baseMixin.methods.getTierOnePackagePrice(lineItemsNoDiscount);
// prettier-ignore
{
if (store.getters.applicationUser.loggingOption) {
console.log(new Date() + " quote tierOnePrice comparison: " + tierOnePrice + " > " + insuranceThreshold + "=" + (tierOnePrice > insuranceThreshold));
}
}
// compare base price vs arbitrary threshold (representing insurance price)
return tierOnePrice > insuranceThreshold;
}
return null;
@ -397,6 +409,12 @@ export default {
}
if (isExternalParameter === externalParameterStatus.NOT_SET) {
// prettier-ignore
{
if (store.getters.applicationUser.loggingOption) {
console.log(new Date() + "quote.vue tab select EXTERNAL not set");
}
}
// there are no active or inactive external parameters; use internal threshold
if (internalThreshold) thresholdToUse = internalThreshold;
@ -408,6 +426,13 @@ export default {
} else {
// user came from an external source, however, the externalParms may have been reset on service-zip, property-questions, etc...
if (getBoolFromString(store.getters.externalParameterQuote?.isInsurance)) {
// prettier-ignore
{
if (store.getters.applicationUser.loggingOption) {
console.log(new Date() + "quote.vue tab select EXTERNAL ISINSURANCE");
}
}
// did user intentionally select insurance?
vm.isInsuranceSelected = true;
vm.servicePackage = store.getters.externalParameterQuote.servicePackage;
@ -427,6 +452,13 @@ export default {
} else {
if (externalThreshold) thresholdToUse = externalThreshold;
// prettier-ignore
{
if (store.getters.applicationUser.loggingOption) {
console.log(new Date() + "quote.vue tab select NOT EXTERNAL");
}
}
vm.isInsuranceSelected = getIsInsuranceSelectedValue(
vm.availableLineItems,
thresholdToUse

View file

@ -18,6 +18,11 @@ import { nextTick } from "vue";
jest.mock("@/store", () => ({
commit: jest.fn(),
dispatch: jest.fn(),
getters: {
applicationUser: {
loggingOption: false,
},
},
}));
const mockExperimentSettings = experimentSettings;
@ -846,6 +851,7 @@ function setupMocks({ mountOptionsMockData, props = mockProps }) {
},
},
};
mountOptionsMockData = Object.assign(mountOptionsMockDataDefault, mountOptionsMockData);
const mountOptions = getMountOptions(mountOptionsMockData);

View file

@ -334,13 +334,20 @@ export default {
if (!this.emailOrSms) {
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
}
else {
} else {
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
const phone = this.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
await this.dispatchStoreAction(
storeActions.SAVE_PHONE_NUMBER,
phone,
false
);
} else {
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false);
await this.dispatchStoreAction(
storeActions.SAVE_EMAIL,
this.emailOrSms,
false
);
}
}
@ -391,13 +398,20 @@ export default {
if (!this.emailOrSms) {
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
}
else {
} else {
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
const phone = this.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
await this.dispatchStoreAction(
storeActions.SAVE_PHONE_NUMBER,
phone,
false
);
} else {
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false);
await this.dispatchStoreAction(
storeActions.SAVE_EMAIL,
this.emailOrSms,
false
);
}
}

View file

@ -92,6 +92,13 @@ export default {
});
let totalPrice = this.getTotalPriceOfAllLineItemsAndChildParts(lineItemsToPrice, false);
// prettier-ignore
{
if (store.getters.applicationUser.loggingOption) {
console.log(new Date() + " base-mixin getTierOnePackagePrice lineItemsToPrice: " + JSON.stringify(lineItemsToPrice));
console.log(new Date() + " base-mixin getTierOnePackagePrice totalPrice: " + totalPrice);
}
}
return totalPrice;
},
filterOutFees(lineItems) {
@ -103,6 +110,12 @@ export default {
});
return filteredLineItems;
},
filterOutServicePackageDiscountPart(lineItems) {
const filteredLineItems = lineItems?.filter((item) => {
return !item?.partType?.includes(partTypeStrings.SERVICE_PACKAGE_DISCOUNT);
});
return filteredLineItems;
},
filterOutRecalibration(lineItems) {
return getItemsWithoutRecalParts(lineItems);
},