Swapping compensation with coverage
This commit is contained in:
parent
ad18f2803e
commit
30de957cdf
3 changed files with 22 additions and 23 deletions
|
|
@ -94,7 +94,7 @@ export default {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
if (useMainStore().isClaimRegistrationRequired && !useMainStore().policy.noCompensation) {
|
if (useMainStore().isClaimRegistrationRequired && !useMainStore().policy.noCoverage) {
|
||||||
const registerClaimResponse = await useMainStore().registerClaim();
|
const registerClaimResponse = await useMainStore().registerClaim();
|
||||||
promiseResultMap.push({
|
promiseResultMap.push({
|
||||||
resultKey: 'registerClaim',
|
resultKey: 'registerClaim',
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
const vin = getRandomString(17,17);
|
const vin = getRandomString(17, 17);
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
bailout: false
|
bailout: false
|
||||||
|
|
@ -130,21 +130,21 @@ describe('policy-vehicles.vue', () => {
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
describe('noCoverageForSelectedVehicle computed property', () => {
|
describe('noCoverageForSelectedVehicle computed property', () => {
|
||||||
it('No vehicle match => returns true', async () => {
|
it('No vehicle match => returns true', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const selectedVin = getRandomString(17,17);
|
const selectedVin = getRandomString(17, 17);
|
||||||
const otherVin = getRandomString(17,17);
|
const otherVin = getRandomString(17, 17);
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: selectedVin,
|
selectedVehicleVin: selectedVin,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
{
|
||||||
vin: otherVin,
|
vin: otherVin
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
|
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
|
||||||
|
|
@ -155,16 +155,16 @@ describe('policy-vehicles.vue', () => {
|
||||||
|
|
||||||
it('Coverages list empty => true', () => {
|
it('Coverages list empty => true', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17,17);
|
const vin = getRandomString(17, 17);
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
{
|
||||||
vin: vin,
|
vin,
|
||||||
coverages: []
|
coverages: []
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
|
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
|
||||||
|
|
@ -175,20 +175,20 @@ describe('policy-vehicles.vue', () => {
|
||||||
|
|
||||||
it('Coverages list non-empty => false', () => {
|
it('Coverages list non-empty => false', () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const vin = getRandomString(17,17);
|
const vin = getRandomString(17, 17);
|
||||||
const testValues = {
|
const testValues = {
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
{
|
{
|
||||||
vin: vin,
|
vin,
|
||||||
coverages: [
|
coverages: [
|
||||||
{
|
{
|
||||||
deductible: 0
|
deductible: 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
|
const result = policyVehicles.computed.noCoverageForSelectedVehicle.call(testValues);
|
||||||
|
|
@ -196,7 +196,7 @@ describe('policy-vehicles.vue', () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
describe('deductibleForSelectedVehicle computed property', () => {
|
describe('deductibleForSelectedVehicle computed property', () => {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,10 +104,9 @@ export default {
|
||||||
}) ?? [];
|
}) ?? [];
|
||||||
return mappedData;
|
return mappedData;
|
||||||
},
|
},
|
||||||
noCompensationForSelectedVehicle() {
|
noCoverageForSelectedVehicle() {
|
||||||
const vehicle = this.policyVehicles.find((policyVehicle) =>
|
const vehicle = this.policyVehicles.find((policyVehicle) =>
|
||||||
policyVehicle.vin === this.selectedVehicleVin);
|
policyVehicle.vin === this.selectedVehicleVin);
|
||||||
console.log((vehicle?.coverages?.length ?? 0) === 0);
|
|
||||||
return (vehicle?.coverages?.length ?? 0) === 0;
|
return (vehicle?.coverages?.length ?? 0) === 0;
|
||||||
},
|
},
|
||||||
deductibleForSelectedVehicle() {
|
deductibleForSelectedVehicle() {
|
||||||
|
|
@ -175,7 +174,7 @@ export default {
|
||||||
|
|
||||||
this.vehicleFromLookup = Object.assign(vehicleLookupResponse.data, {
|
this.vehicleFromLookup = Object.assign(vehicleLookupResponse.data, {
|
||||||
vin: this.selectedVehicleVin,
|
vin: this.selectedVehicleVin,
|
||||||
noCoverage: this.noCompensationForSelectedVehicle,
|
noCoverage: this.noCoverageForSelectedVehicle,
|
||||||
deductible: this.deductibleForSelectedVehicle,
|
deductible: this.deductibleForSelectedVehicle,
|
||||||
repairWaived: this.repairWaivedForSelectedVehicle
|
repairWaived: this.repairWaivedForSelectedVehicle
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue