Swapping compensation with coverage

This commit is contained in:
brydon1 2023-07-17 13:38:02 -04:00
parent ad18f2803e
commit 30de957cdf
3 changed files with 22 additions and 23 deletions

View file

@ -94,7 +94,7 @@ export default {
}
];
if (useMainStore().isClaimRegistrationRequired && !useMainStore().policy.noCompensation) {
if (useMainStore().isClaimRegistrationRequired && !useMainStore().policy.noCoverage) {
const registerClaimResponse = await useMainStore().registerClaim();
promiseResultMap.push({
resultKey: 'registerClaim',

View file

@ -89,7 +89,7 @@ describe('policy-vehicles.vue', () => {
//Arrange
const { wrapper } = setupMocks({});
const vin = getRandomString(17,17);
const vin = getRandomString(17, 17);
await wrapper.setData({
selectedVehicleVin: vin,
bailout: false
@ -130,21 +130,21 @@ describe('policy-vehicles.vue', () => {
{}
);
});
})
});
describe('noCoverageForSelectedVehicle computed property', () => {
it('No vehicle match => returns true', async () => {
// Arrange
const selectedVin = getRandomString(17,17);
const otherVin = getRandomString(17,17);
const selectedVin = getRandomString(17, 17);
const otherVin = getRandomString(17, 17);
const testValues = {
selectedVehicleVin: selectedVin,
policyVehicles: [
{
vin: otherVin,
},
],
}
vin: otherVin
}
]
};
// Act
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
@ -155,16 +155,16 @@ describe('policy-vehicles.vue', () => {
it('Coverages list empty => true', () => {
// Arrange
const vin = getRandomString(17,17);
const vin = getRandomString(17, 17);
const testValues = {
selectedVehicleVin: vin,
policyVehicles: [
{
vin: vin,
vin,
coverages: []
},
],
}
}
]
};
// Act
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
@ -175,20 +175,20 @@ describe('policy-vehicles.vue', () => {
it('Coverages list non-empty => false', () => {
// Arrange
const vin = getRandomString(17,17);
const vin = getRandomString(17, 17);
const testValues = {
selectedVehicleVin: vin,
policyVehicles: [
{
vin: vin,
vin,
coverages: [
{
deductible: 0
}
]
},
],
}
}
]
};
// Act
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
@ -196,7 +196,7 @@ describe('policy-vehicles.vue', () => {
// Assert
expect(result).toBeFalsy();
});
})
});
describe('deductibleForSelectedVehicle computed property', () => {

View file

@ -104,10 +104,9 @@ export default {
}) ?? [];
return mappedData;
},
noCompensationForSelectedVehicle() {
noCoverageForSelectedVehicle() {
const vehicle = this.policyVehicles.find((policyVehicle) =>
policyVehicle.vin === this.selectedVehicleVin);
console.log((vehicle?.coverages?.length ?? 0) === 0);
return (vehicle?.coverages?.length ?? 0) === 0;
},
deductibleForSelectedVehicle() {
@ -175,7 +174,7 @@ export default {
this.vehicleFromLookup = Object.assign(vehicleLookupResponse.data, {
vin: this.selectedVehicleVin,
noCoverage: this.noCompensationForSelectedVehicle,
noCoverage: this.noCoverageForSelectedVehicle,
deductible: this.deductibleForSelectedVehicle,
repairWaived: this.repairWaivedForSelectedVehicle
});