Fix tests, correct part number string for repair supplies
This commit is contained in:
parent
db69745484
commit
ca6ec847d0
3 changed files with 28 additions and 4 deletions
|
|
@ -3,7 +3,8 @@ const partNumberStrings = Object.freeze({
|
||||||
LABOR2: 'LABOR2',
|
LABOR2: 'LABOR2',
|
||||||
RECAL_MOBILE: 'RECAL MOBILE',
|
RECAL_MOBILE: 'RECAL MOBILE',
|
||||||
RECAL_MOBILEDUAL: 'RECAL MOBILEDUAL',
|
RECAL_MOBILEDUAL: 'RECAL MOBILEDUAL',
|
||||||
REPAIR_SUPPLIES: 'REPAIR-SUPPLIES'
|
REPAIR: 'WSREPAIR',
|
||||||
|
SUPPLIES_REPAIR: 'SUPPLIES-REPAIR'
|
||||||
});
|
});
|
||||||
|
|
||||||
export default partNumberStrings;
|
export default partNumberStrings;
|
||||||
|
|
|
||||||
|
|
@ -1034,7 +1034,7 @@ export const useMainStore = defineStore({
|
||||||
const damageType = this.damage.isRepair ? 'Repair' : 'Install';
|
const damageType = this.damage.isRepair ? 'Repair' : 'Install';
|
||||||
|
|
||||||
const parts = getLineItemsFlattened(this.order.lineItems.glassParts);
|
const parts = getLineItemsFlattened(this.order.lineItems.glassParts);
|
||||||
const partNumbers = this.damage.isRepair ? 'WSREPAIR' : parts.map((part) => part.partNumber).join(',');
|
const partNumbers = this.damage.isRepair ? partNumberStrings.REPAIR : parts.map((part) => part.partNumber).join(',');
|
||||||
|
|
||||||
let url = `${endpoints.GetTpaAndSafeliteProviders.url}/${zipCode}?accountNumber=${parentAccountNumber}&carId=${carId}&damageType=${damageType}&partNumbers=${partNumbers}`;
|
let url = `${endpoints.GetTpaAndSafeliteProviders.url}/${zipCode}?accountNumber=${parentAccountNumber}&carId=${carId}&damageType=${damageType}&partNumbers=${partNumbers}`;
|
||||||
if (provderNameSearchString) {
|
if (provderNameSearchString) {
|
||||||
|
|
@ -1989,7 +1989,7 @@ export const useMainStore = defineStore({
|
||||||
let supportingItems = partsData.filter((i) => i.partNumber !== partNumberStrings.RECYCLE_FEE);
|
let supportingItems = partsData.filter((i) => i.partNumber !== partNumberStrings.RECYCLE_FEE);
|
||||||
|
|
||||||
// Remove Repair Supplies Fee, which is hidden for ISS except in scenarios not yet implemented
|
// Remove Repair Supplies Fee, which is hidden for ISS except in scenarios not yet implemented
|
||||||
supportingItems = supportingItems.filter((i) => i.partNumber !== partNumberStrings.REPAIR_SUPPLIES);
|
supportingItems = supportingItems.filter((i) => i.partNumber !== partNumberStrings.SUPPLIES_REPAIR);
|
||||||
|
|
||||||
this.order.lineItems.supportingItems = supportingItems;
|
this.order.lineItems.supportingItems = supportingItems;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import { AppointmentTypeStrings } from '@/constants/schedule-constants';
|
||||||
import coverageType from '@/constants/coverage-type';
|
import coverageType from '@/constants/coverage-type';
|
||||||
import { getEnumName } from '@/helpers/unit-test-helper';
|
import { getEnumName } from '@/helpers/unit-test-helper';
|
||||||
import { strictEqual } from 'assert';
|
import { strictEqual } from 'assert';
|
||||||
|
import partNumberStrings from '@/constants/part-number-strings';
|
||||||
|
|
||||||
describe('Store', () => {
|
describe('Store', () => {
|
||||||
let store;
|
let store;
|
||||||
|
|
@ -1978,7 +1979,7 @@ describe('Store', () => {
|
||||||
|
|
||||||
const carId = getRandomString(10, 14);
|
const carId = getRandomString(10, 14);
|
||||||
const parentAccountNumber = getRandomString(6, 6);
|
const parentAccountNumber = getRandomString(6, 6);
|
||||||
const partNumber = getRandomString(6, 6);
|
const partNumber = isRepair ? partNumberStrings.REPAIR : getRandomString(6, 6);
|
||||||
store.order.parentAccountNumber = parentAccountNumber;
|
store.order.parentAccountNumber = parentAccountNumber;
|
||||||
store.order.damage.isRepair = isRepair;
|
store.order.damage.isRepair = isRepair;
|
||||||
store.order.vehicle.carId = carId;
|
store.order.vehicle.carId = carId;
|
||||||
|
|
@ -2512,6 +2513,28 @@ describe('Store', () => {
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('updateSupportingItems removes Repair Supplies Fee from supporting items in store', () => {
|
||||||
|
// Arrange
|
||||||
|
const partsData = [
|
||||||
|
{
|
||||||
|
partNumber: partNumberStrings.SUPPLIES_REPAIR,
|
||||||
|
partType: 'REPAIR FEE'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// Act
|
||||||
|
store.updateSupportingItems(partsData);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.order.lineItems.supportingItems).not.toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
expect.objectContaining({
|
||||||
|
partNumber: partNumberStrings.SUPPLIES_REPAIR,
|
||||||
|
partType: 'REPAIR FEE'
|
||||||
|
})
|
||||||
|
])
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('updateGlassFees method', () => {
|
describe('updateGlassFees method', () => {
|
||||||
it('updateGlassFees does not add Labor2 fee to feeItems', () => {
|
it('updateGlassFees does not add Labor2 fee to feeItems', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue