Update names in damage-helper
This commit is contained in:
parent
9bbaec7fe4
commit
a0a0ccfbea
3 changed files with 10 additions and 11 deletions
|
|
@ -19,7 +19,7 @@ export function getDamageString() {
|
|||
if (damageLocations.length > 1) {
|
||||
returnString = "match"
|
||||
} else {
|
||||
switch(damageLocations[0]?.location) {
|
||||
switch(damageLocations[0]?.glassLocation) {
|
||||
case "Windshield":
|
||||
returnString = "windshield"
|
||||
break;
|
||||
|
|
@ -36,7 +36,7 @@ export function getDamageString() {
|
|||
|
||||
export function getIsWindshieldOnly () {
|
||||
const damageLocations = store.getters.damage.glassToReplace;
|
||||
const returnString = damageLocations.length === 1 && damageLocations[0]?.location === "Windshield" ? "windshield" : "glass";
|
||||
const returnString = damageLocations.length === 1 && damageLocations[0]?.glassLocation === "Windshield" ? "windshield" : "glass";
|
||||
return returnString;
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ export async function isGlassAvailableForCarId(carId){
|
|||
}
|
||||
|
||||
for(const option of currentGlassOptions){
|
||||
if(!newGlassOptions.data[optionsMap[option.location]].availableReplacementOptions.includes(option.name)){
|
||||
if(!newGlassOptions.data[optionsMap[option.glassLocation]].availableReplacementOptions.includes(option.glassName)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
it("Should return match when multiple selected damage options are in the store", () => {
|
||||
|
||||
// Arrange / Act
|
||||
store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}, {location: "Passenger", name: "sideWindow"}];
|
||||
store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "windshield"}, {glassLocation: "Passenger", glassName: "sideWindow"}];
|
||||
|
||||
const damage = getDamageString();
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
it("Should return windshield when Windshield is the only selected damage option in the store", () => {
|
||||
|
||||
// Arrange / Act
|
||||
store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}];
|
||||
store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "windshield"}];
|
||||
|
||||
const damage = getDamageString();
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
it("Should return side window when Driver or Passenger is the only selected damage option in the store", () => {
|
||||
|
||||
// Arrange / Act
|
||||
store.getters.damage.glassToReplace = [{location: "Passenger", name: "sideWindow"}];
|
||||
store.getters.damage.glassToReplace = [{glassLocation: "Passenger", glassName: "sideWindow"}];
|
||||
|
||||
const damage = getDamageString();
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
it("Should return rear window when Rear is the only selected damage option in the store", () => {
|
||||
|
||||
// Arrange / Act
|
||||
store.getters.damage.glassToReplace = [{location: "Rear", name: "rear"}];
|
||||
store.getters.damage.glassToReplace = [{glassLocation: "Rear", glassName: "rear"}];
|
||||
|
||||
const damage = getDamageString();
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
describe("damage-helper.js", () => {
|
||||
it("Should return true if no mismatches between each array exist", async () => {
|
||||
// Arrange
|
||||
store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}];
|
||||
store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "windshield"}];
|
||||
|
||||
// Act
|
||||
const isGlassAvailable = await isGlassAvailableForCarId();
|
||||
|
|
@ -80,7 +80,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({
|
|||
describe("damage-helper.js", () => {
|
||||
it("Should return false if any mismatches between each array exist", async () => {
|
||||
// Arrange
|
||||
store.getters.damage.glassToReplace = [{location: "Windshield", name: "sideWindow"}];
|
||||
store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "sideWindow"}];
|
||||
|
||||
const isGlassAvailable = await isGlassAvailableForCarId();
|
||||
|
||||
|
|
|
|||
|
|
@ -267,8 +267,7 @@ export default {
|
|||
`Continue with ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`
|
||||
);
|
||||
this.isVinValid = true;
|
||||
this.isSelectedGlassAvailableForVehicle =
|
||||
await isGlassAvailableForCarId(vinLookup.data.vehicle.carId);
|
||||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vinLookup.data.vehicle.carId);
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue