Checking in before writing some unit tests

This commit is contained in:
Leah Schumann 2023-02-20 10:39:06 -05:00
parent e583a903a1
commit 52e5c7d532
5 changed files with 36 additions and 7 deletions

View file

@ -70,6 +70,10 @@ const endpoints = {
url: "/parts/api/v1/parts/rain-defense",
method: "GET",
},
GetMobileFeePart: {
url: "/parts/api/v1/parts/mobile-fee",
method: "GET",
},
GetSupportingItems: {
url: "/parts/api/v1/parts/supporting-items",
method: "POST",

View file

@ -27,6 +27,7 @@ const storeActions = {
GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions",
GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer",
GET_MOLDING_QUESTIONS: "getMoldingQuestions",
GET_MOBILE_FEE_PART: "getMobileFeePart",
SAVE_SESSION: "saveSession",
LOAD_SESSION: "loadSession",
UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE: "updateStoreWithSaveSessionResponse",

View file

@ -76,9 +76,7 @@ export default {
includeSearchIcon: Boolean,
},
setup(props) {
const inputId = !props.customInputId
? `input-${crypto.randomUUID()}`
: props.customInputId;
const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId;
const propsClone = Object.assign({}, props);
const modelValue = propsClone.modelValue;

View file

@ -53,6 +53,8 @@ import alert from "@/ux-components/alert/alert";
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
import textBlock from "@/digital-components/text-block/text-block";
import baseMixin from "@/mixins/base-mixin.js";
import { storeActions } from "@/constants/store-actions";
export default {
name: "mobile-location-modal-questions",
@ -61,7 +63,7 @@ export default {
return {
internalModel: this.copyModel(this.modelValue),
displayInvalidZipAlert: false,
mobileFee: this.getMobileFee(),
mobileFee: ""
};
},
props: {
@ -88,6 +90,9 @@ export default {
alertNonServiceableZipWidgetName: String,
alertInvalidZipWidgetName: String,
},
async mounted() {
this.mobileFee = await this.getMobileFee();
},
computed: {
mobileFeeText() {
const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text");
@ -142,10 +147,24 @@ export default {
isZipServiceableInShop: modelToCopy.isZipServiceableInShop,
};
},
async getMobileFee() {
// Get the Mobile Fee Part
const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_FEE_PART,
null,
false
);
// Get the Mobile Fee Part Price
const pricingResults = await baseMixin.methods.dispatchStoreAction(
storeActions.PRICE_ORDER_ITEMS,
[ mobileFeePart.data ],
false
);
return await baseMixin.methods.getTotalLineItemPrice(pricingResults[0]);
getMobileFee() {
// TODO: Call new service endpoint to get the Mobile Fee price
return "34.99";
},
openModal() {

View file

@ -907,6 +907,13 @@ export const actions = {
});
},
getMobileFeePart(context) {
return globalMethods.callMockHttpClient({
method: endpoints.GetMobileFeePart.method,
endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce", //TODO: Remove Mocky Endpoint
});
},
getSupportingItems(context) {
const glassPartsArray = context.getters.lineItems.glassParts ?? [];
const carId = context.getters.vehicle.carId;