CASH-132 tech review updates.
This commit is contained in:
parent
5987e78e2a
commit
5302d04f22
9 changed files with 105 additions and 103 deletions
|
|
@ -2,6 +2,7 @@ const partNumberStrings = {
|
||||||
// Recalibration
|
// Recalibration
|
||||||
MOBILE_STATIC_RECAL_FEE: "RECAL MOBILE",
|
MOBILE_STATIC_RECAL_FEE: "RECAL MOBILE",
|
||||||
MOBILE_DUAL_RECAL_FEE: "RECAL MOBILEDUAL",
|
MOBILE_DUAL_RECAL_FEE: "RECAL MOBILEDUAL",
|
||||||
|
DONATION: "DONATION",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { partNumberStrings };
|
export { partNumberStrings };
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleDonationAction(submitEvent) {
|
handleDonationAction(submitEvent) {
|
||||||
console.log(
|
|
||||||
"running handleDonationAction(), submitEvent.target.elements.amount.value: ",
|
|
||||||
submitEvent.target.elements.amount.value
|
|
||||||
);
|
|
||||||
this.selectedValue = submitEvent.target.elements.amount.value;
|
this.selectedValue = submitEvent.target.elements.amount.value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ export default {
|
||||||
}
|
}
|
||||||
@include media-breakpoint-up(lg) {
|
@include media-breakpoint-up(lg) {
|
||||||
&:before {
|
&:before {
|
||||||
top: .5rem;
|
top: 0.5rem;
|
||||||
}
|
}
|
||||||
&:after {
|
&:after {
|
||||||
top: 1.4375rem;
|
top: 1.4375rem;
|
||||||
|
|
@ -223,7 +223,7 @@ export default {
|
||||||
|
|
||||||
+ .package-label.pricing-by-day-pkg-lbl-ins {
|
+ .package-label.pricing-by-day-pkg-lbl-ins {
|
||||||
&:before {
|
&:before {
|
||||||
top: .3125rem;
|
top: 0.3125rem;
|
||||||
}
|
}
|
||||||
&:after {
|
&:after {
|
||||||
top: 1.25rem;
|
top: 1.25rem;
|
||||||
|
|
@ -234,7 +234,7 @@ export default {
|
||||||
&:before {
|
&:before {
|
||||||
top: 0.9375rem;
|
top: 0.9375rem;
|
||||||
@include media-breakpoint-up(lg) {
|
@include media-breakpoint-up(lg) {
|
||||||
top: .3125rem;
|
top: 0.3125rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:after {
|
&:after {
|
||||||
|
|
@ -258,7 +258,7 @@ export default {
|
||||||
min-height: 52px;
|
min-height: 52px;
|
||||||
max-height: 126px;
|
max-height: 126px;
|
||||||
@include media-breakpoint-up(md) {
|
@include media-breakpoint-up(md) {
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
}
|
}
|
||||||
transition: max-height 0.25s ease-in;
|
transition: max-height 0.25s ease-in;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ export default {
|
||||||
transition: background 0s 0s ease-in-out;
|
transition: background 0s 0s ease-in-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal.modal-component .modal-dialog .modal-content {
|
.modal.modal-component .modal-dialog .modal-content {
|
||||||
.modal-header {
|
.modal-header {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
|
|
|
||||||
|
|
@ -361,13 +361,16 @@ export default {
|
||||||
if (!this.customerQuestions.emailOrSms) {
|
if (!this.customerQuestions.emailOrSms) {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (vinPagesMixin.methods.isPhoneNumber(this.customerQuestions.emailOrSms)) {
|
if (vinPagesMixin.methods.isPhoneNumber(this.customerQuestions.emailOrSms)) {
|
||||||
const phone = this.customerQuestions.emailOrSms.replace(/[()]/g, "");
|
const phone = this.customerQuestions.emailOrSms.replace(/[()]/g, "");
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
|
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
|
||||||
} else {
|
} else {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.customerQuestions.emailOrSms, false);
|
await this.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_EMAIL,
|
||||||
|
this.customerQuestions.emailOrSms,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
:isItac="isItac"
|
:isItac="isItac"
|
||||||
:isNoComp="isNoComp" />
|
:isNoComp="isNoComp" />
|
||||||
|
|
||||||
<div class="mt-3" v-if="displayFosterLove">
|
<div class="mt-3" v-if="DisplayFosterLove">
|
||||||
<donationBlock
|
<donationBlock
|
||||||
cmsWidgetName="DonationWidget"
|
cmsWidgetName="DonationWidget"
|
||||||
v-model="donationAmount"
|
v-model="donationAmount"
|
||||||
|
|
@ -73,10 +73,6 @@
|
||||||
:showDonationError="showDonationError" />
|
:showDonationError="showDonationError" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <button type="button" @click="addDonation(3)">
|
|
||||||
Add Donation of $3
|
|
||||||
</button> -->
|
|
||||||
|
|
||||||
<hr class="mb-5" />
|
<hr class="mb-5" />
|
||||||
|
|
||||||
<div class="emailtext" v-html="ConfirmationEmailText"></div>
|
<div class="emailtext" v-html="ConfirmationEmailText"></div>
|
||||||
|
|
@ -122,6 +118,7 @@ import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
||||||
import { containsRecalParts } from "@/helpers/recal-helper.js";
|
import { containsRecalParts } from "@/helpers/recal-helper.js";
|
||||||
import donationBlock from "@/experiment-components/donation-block.vue";
|
import donationBlock from "@/experiment-components/donation-block.vue";
|
||||||
|
import { partNumberStrings } from "@/constants/part-number-strings";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "confirmation",
|
name: "confirmation",
|
||||||
|
|
@ -219,7 +216,7 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
const donationItems = lineItemsFromSubmittedOrder.supportingItems?.filter(
|
const donationItems = lineItemsFromSubmittedOrder.supportingItems?.filter(
|
||||||
(item) => item.partNumber === "DONATION"
|
(item) => item.partNumber === partNumberStrings.DONATION
|
||||||
);
|
);
|
||||||
const donationAmount = donationItems?.length > 0 ? donationItems[0].sellingPrice : 0;
|
const donationAmount = donationItems?.length > 0 ? donationItems[0].sellingPrice : 0;
|
||||||
|
|
||||||
|
|
@ -532,13 +529,9 @@ export default {
|
||||||
"test",
|
"test",
|
||||||
false
|
false
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
// this.$refs.navbar.removeLoader();
|
|
||||||
console.error("Error!!! error: ", error);
|
|
||||||
return error;
|
return error;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("ran addDonation()... (*fake call*) donationResponse: ", donationResponse);
|
|
||||||
|
|
||||||
if (donationResponse?.status == "200") {
|
if (donationResponse?.status == "200") {
|
||||||
this.showDonationSuccess = true;
|
this.showDonationSuccess = true;
|
||||||
this.showDonationError = false;
|
this.showDonationError = false;
|
||||||
|
|
@ -561,7 +554,6 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
donationAmount(newValue) {
|
donationAmount(newValue) {
|
||||||
newValue = parseInt(newValue);
|
newValue = parseInt(newValue);
|
||||||
console.log("WATCHED donationAmount changed: ", newValue);
|
|
||||||
|
|
||||||
// this.addDonation(newValue);
|
// this.addDonation(newValue);
|
||||||
// TODO - when backend code is final, then remove the below and restore the line above
|
// TODO - when backend code is final, then remove the below and restore the line above
|
||||||
|
|
|
||||||
|
|
@ -1,105 +1,102 @@
|
||||||
import { shallowMount } from '@vue/test-utils';
|
import { shallowMount } from "@vue/test-utils";
|
||||||
import InsuranceCompany from '@/layouts/insurance-company/insurance-company.vue';
|
import InsuranceCompany from "@/layouts/insurance-company/insurance-company.vue";
|
||||||
import { applicationConfig } from '@/constants/application-config.js';
|
import { applicationConfig } from "@/constants/application-config.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
|
jest.mock("@/store", () => ({
|
||||||
jest.mock('@/store', () => ({
|
|
||||||
getters: {
|
getters: {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
parentAccountNumber: '12345',
|
parentAccountNumber: "12345",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var mockRouter = {
|
var mockRouter = {
|
||||||
navigateWithoutSaving: jest.fn(),
|
navigateWithoutSaving: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
jest.mock('@/mixins/base-mixin.js', () => ({
|
jest.mock("@/mixins/base-mixin.js", () => ({
|
||||||
methods: {
|
methods: {
|
||||||
navigateWithoutSaving: jest.fn(),
|
navigateWithoutSaving: jest.fn(),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
navigationScenarios: {
|
navigationScenarios: {
|
||||||
CLICKED_BACK: 'clicked_back',
|
CLICKED_BACK: "clicked_back",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe("insurance-company.vue", () => {
|
describe("insurance-company.vue", () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Reset the store's parentAccountNumber before each test
|
// 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";
|
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, {
|
const wrapper = shallowMount(InsuranceCompany, {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
$store: store,
|
$store: store,
|
||||||
$router: mockRouter,
|
},
|
||||||
},
|
|
||||||
mixins: [baseMixin],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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);
|
wrapper.vm.backButtonAction(true);
|
||||||
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
wrapper.vm.navigationScenarios.CLICKED_BACK,
|
wrapper.vm.navigationScenarios.CLICKED_BACK,
|
||||||
wrapper.vm.$route,
|
wrapper.vm.$route,
|
||||||
{ isCashSelected: true }
|
{ 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, {
|
const wrapper = shallowMount(InsuranceCompany, {
|
||||||
global: {
|
global: {
|
||||||
mocks: {
|
mocks: {
|
||||||
$store: store,
|
$store: store,
|
||||||
$router: mockRouter,
|
$router: mockRouter,
|
||||||
|
},
|
||||||
|
mixins: [baseMixin],
|
||||||
},
|
},
|
||||||
mixins: [baseMixin],
|
});
|
||||||
},
|
|
||||||
});
|
|
||||||
wrapper.vm.backButtonAction(false);
|
wrapper.vm.backButtonAction(false);
|
||||||
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(mockRouter.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
wrapper.vm.navigationScenarios.CLICKED_BACK,
|
wrapper.vm.navigationScenarios.CLICKED_BACK,
|
||||||
wrapper.vm.$route
|
wrapper.vm.$route
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -315,8 +315,7 @@ export default {
|
||||||
if (!this.emailOrSms) {
|
if (!this.emailOrSms) {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
|
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
|
||||||
const phone = this.emailOrSms.replace(/[()]/g, "");
|
const phone = this.emailOrSms.replace(/[()]/g, "");
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
|
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
|
||||||
|
|
|
||||||
|
|
@ -334,13 +334,20 @@ export default {
|
||||||
if (!this.emailOrSms) {
|
if (!this.emailOrSms) {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
|
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
|
||||||
const phone = this.emailOrSms.replace(/[()]/g, "");
|
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 {
|
} 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) {
|
if (!this.emailOrSms) {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
|
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
|
||||||
const phone = this.emailOrSms.replace(/[()]/g, "");
|
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 {
|
} else {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false);
|
await this.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_EMAIL,
|
||||||
|
this.emailOrSms,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue