Formatting and Unit Tests
This commit is contained in:
parent
7341f0a88e
commit
d5ab55644f
4 changed files with 36 additions and 74 deletions
|
|
@ -1148,16 +1148,17 @@ export default {
|
||||||
onShopSelected(shopQuestionPopUpData) {
|
onShopSelected(shopQuestionPopUpData) {
|
||||||
this.shopProviderData = shopQuestionPopUpData.shopProviderData;
|
this.shopProviderData = shopQuestionPopUpData.shopProviderData;
|
||||||
this.setServiceabilityDetails(shopQuestionPopUpData.serviceabilityDetails);
|
this.setServiceabilityDetails(shopQuestionPopUpData.serviceabilityDetails);
|
||||||
this.selectedProvider = this.shopProviderData.shopProviders.find(shopProvider => {
|
this.selectedProvider = this.shopProviderData.shopProviders.find((shopProvider) => {
|
||||||
return shopProvider.providerNumber === shopQuestionPopUpData.selectedProviderNumber;
|
return shopProvider.providerNumber === shopQuestionPopUpData.selectedProviderNumber;
|
||||||
})
|
});
|
||||||
|
|
||||||
// No zipCodeData comes back if zip was not changed
|
// No zipCodeData comes back if zip was not changed
|
||||||
if (shopQuestionPopUpData.zipCodeData) {
|
if (shopQuestionPopUpData.zipCodeData) {
|
||||||
this.zipCode = shopQuestionPopUpData.zipCodeData.zipCode;
|
this.zipCode = shopQuestionPopUpData.zipCodeData.zipCode;
|
||||||
this.state = shopQuestionPopUpData.zipCodeData.state;
|
this.state = shopQuestionPopUpData.zipCodeData.state;
|
||||||
this.zipCodeCtu = shopQuestionPopUpData.zipCodeData.zipCodeCtu;
|
this.zipCodeCtu = shopQuestionPopUpData.zipCodeData.zipCodeCtu;
|
||||||
this.zipContainsMilitaryBase = shopQuestionPopUpData.zipCodeData.containsMilitaryBase;
|
this.zipContainsMilitaryBase =
|
||||||
|
shopQuestionPopUpData.zipCodeData.containsMilitaryBase;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getMoreScheduleData(startDate, endDate) {
|
async getMoreScheduleData(startDate, endDate) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
import {
|
import { getPricedMobileFeePart, getServiceabilityDetails } from "./service-location-helper";
|
||||||
getPricedMobileFeePart,
|
|
||||||
getServiceabilityDetails,
|
|
||||||
getAvailabilityRating,
|
|
||||||
} from "./service-location-helper";
|
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
|
||||||
jest.mock("@/store", () => ({
|
jest.mock("@/store", () => ({
|
||||||
|
|
@ -320,38 +316,4 @@ describe("service-location-helper.js", () => {
|
||||||
expect(result).toEqual(expected);
|
expect(result).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getAvailabilityRating", () => {
|
|
||||||
it("Should return a 'high' rating", async () => {
|
|
||||||
// Arrange
|
|
||||||
const providerNumber = "0000001";
|
|
||||||
const expected = "high";
|
|
||||||
// Act
|
|
||||||
const result = await getAvailabilityRating(
|
|
||||||
"2023-06-30",
|
|
||||||
"2023-07-06",
|
|
||||||
"Inshop",
|
|
||||||
providerNumber
|
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toEqual(expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Should return a 'low' rating", async () => {
|
|
||||||
// Arrange
|
|
||||||
const providerNumber = "0000000";
|
|
||||||
const expected = "low";
|
|
||||||
// Act
|
|
||||||
const result = await getAvailabilityRating(
|
|
||||||
"2023-06-30",
|
|
||||||
"2023-07-06",
|
|
||||||
"Inshop",
|
|
||||||
providerNumber
|
|
||||||
);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(result).toEqual(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,12 @@ export default {
|
||||||
|
|
||||||
const shopAppointmentType = this.additionalButtonData.shopAppointmentType;
|
const shopAppointmentType = this.additionalButtonData.shopAppointmentType;
|
||||||
|
|
||||||
this.getAvailabilityRating(formattedStartDate, formattedEndDate, shopAppointmentType, this.value)
|
this.getAvailabilityRating(
|
||||||
.then((data) => {
|
formattedStartDate,
|
||||||
|
formattedEndDate,
|
||||||
|
shopAppointmentType,
|
||||||
|
this.value
|
||||||
|
).then((data) => {
|
||||||
this.availabilityRating = data;
|
this.availabilityRating = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -106,12 +110,7 @@ export default {
|
||||||
displayLoader() {
|
displayLoader() {
|
||||||
this.isLoaderDisplayed = true;
|
this.isLoaderDisplayed = true;
|
||||||
},
|
},
|
||||||
async getAvailabilityRating(
|
async getAvailabilityRating(startDate, endDate, shopAppointmentType, providerNumber) {
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
shopAppointmentType,
|
|
||||||
providerNumber
|
|
||||||
) {
|
|
||||||
// For a given shop provider number and date range, get the appointment time slots available
|
// For a given shop provider number and date range, get the appointment time slots available
|
||||||
const shopTimeSlots = await this.dispatchStoreActionWithLogging(
|
const shopTimeSlots = await this.dispatchStoreActionWithLogging(
|
||||||
this.storeActions.GET_SHOP_TIME_SLOTS,
|
this.storeActions.GET_SHOP_TIME_SLOTS,
|
||||||
|
|
|
||||||
|
|
@ -166,9 +166,11 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
answers() {
|
answers() {
|
||||||
const updatedProvidersToDisplay = this.shopProviders.slice(0, this.numberOfShopsToDisplay);
|
const updatedProvidersToDisplay = this.shopProviders.slice(
|
||||||
return updatedProvidersToDisplay.map(
|
0,
|
||||||
(shopProvider) => {
|
this.numberOfShopsToDisplay
|
||||||
|
);
|
||||||
|
return updatedProvidersToDisplay.map((shopProvider) => {
|
||||||
const streetAddress = this.toTitleCase(shopProvider.address.streetAddress);
|
const streetAddress = this.toTitleCase(shopProvider.address.streetAddress);
|
||||||
const city = this.toTitleCase(shopProvider.address.city);
|
const city = this.toTitleCase(shopProvider.address.city);
|
||||||
const state = shopProvider.address.state;
|
const state = shopProvider.address.state;
|
||||||
|
|
@ -182,8 +184,7 @@ export default {
|
||||||
additionalButtonData: this.additionalButtonData,
|
additionalButtonData: this.additionalButtonData,
|
||||||
value: shopProvider.providerNumber,
|
value: shopProvider.providerNumber,
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -303,13 +304,12 @@ export default {
|
||||||
serviceabilityDetails: serviceabilityDetails.data,
|
serviceabilityDetails: serviceabilityDetails.data,
|
||||||
zipCodeData: this.zipCodeData,
|
zipCodeData: this.zipCodeData,
|
||||||
shopProviderData: this.localShopProviderData,
|
shopProviderData: this.localShopProviderData,
|
||||||
selectedProviderNumber: this.localSelectedProviderNumber
|
selectedProviderNumber: this.localSelectedProviderNumber,
|
||||||
}
|
};
|
||||||
this.$emit("shop-selected", shopQuestionPopUpData);
|
this.$emit("shop-selected", shopQuestionPopUpData);
|
||||||
|
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
modal,
|
modal,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue