{{ appointmentDateFormatted }}
+{{ appointmentTimeFormatted }}
+diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js
index 6ac0a793..84c1d1f2 100644
--- a/src/constants/endpoints.js
+++ b/src/constants/endpoints.js
@@ -1,204 +1,204 @@
-const baseContentUrl = '/content/api/v1/content';
-const baseLocationUrl = '/location/api/v1/location';
-const baseScheduleUrl = '/schedule/api/v1/schedule';
-const basePartsUrl = '/parts/api/v1/parts';
-const baseVehicleUrl = '/vehicle/api/v1/vehicle';
-const basePriceUrl = '/price/api/v1/price';
-const baseAnalyticsUrl = '/analytics/api/v1/analytics';
-const baseExperimentsUrl = '/experiments/api/v1/experiments';
-const baseClientAuthUrl = '/clientauth/api/v1/clientauth';
-const baseOrderUrl = '/order/api/v1/order';
-const baseCoverageUrl = '/coverage/api/v1/coverage';
-const baseAccountUrl = '/account/api/v1/account/';
+const CONTENT_BASE_URL = '/content/api/v1/content';
+const LOCATION_BASE_URL = '/location/api/v1/location';
+const SCHEDULE_BASE_URL = '/schedule/api/v1/schedule';
+const PARTS_BASE_URL = '/parts/api/v1/parts';
+const VEHICLE_BASE_URL = '/vehicle/api/v1/vehicle';
+const PRICE_BASE_URL = '/price/api/v1/price';
+const ACCOUNT_BASE_URL = '/account/api/v1/account';
+const EXPERIMENTS_BASE_URL = '/experiments/api/v1/experiments';
+const ANALYTICS_BASE_URL = '/analytics/api/v1/analytics';
+const CLIENT_AUTH_BASE_URL = '/clientauth/api/v1/clientauth';
+const COVERAGE_BASE_URL = '/coverage/api/v1/coverage';
+const ORDER_BASE_URL = '/order/api/v1/order';
const endpoints = Object.freeze({
GetRouteInfo: {
- url: (applicationAbbreviation) => `${baseContentUrl}/${applicationAbbreviation}/RouteInfo`,
+ url: (applicationAbbreviation) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/RouteInfo`,
method: 'POST'
},
GetHomepageInfo: {
- url: (applicationAbbreviation) => `${baseContentUrl}/${applicationAbbreviation}/HomepageInfo`,
+ url: (applicationAbbreviation) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/HomepageInfo`,
method: 'GET'
},
GetPageData: {
- url: (applicationAbbreviation, pageName) => `${baseContentUrl}/${applicationAbbreviation}/${pageName}`,
+ url: (applicationAbbreviation, pageName) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/${pageName}`,
method: 'GET'
},
GetAlertReasons: {
- url: `${baseLocationUrl}/alert-reasons`,
+ url: `${LOCATION_BASE_URL}/alert-reasons`,
method: 'GET'
},
GetShopTimeSlots: {
- url: `${baseScheduleUrl}/shop-time-slots`,
+ url: `${SCHEDULE_BASE_URL}/shop-time-slots`,
method: 'POST'
},
GetMobileTimeSlots: {
- url: `${baseScheduleUrl}/mobile-time-slots`,
+ url: `${SCHEDULE_BASE_URL}/mobile-time-slots`,
method: 'POST'
},
GetMobilePremiumFee: {
- url: `${basePartsUrl}/mobile-premium-fee`,
+ url: `${PARTS_BASE_URL}/mobile-premium-fee`,
method: 'GET'
},
GetVehicleYears: {
- url: `${baseVehicleUrl}/years`,
+ url: `${VEHICLE_BASE_URL}/years`,
method: 'GET'
},
GetVehicleMakes: {
- url: `${baseVehicleUrl}/makes/`,
+ url: `${VEHICLE_BASE_URL}/makes/`,
method: 'GET'
},
GetVehicleModels: {
- url: `${baseVehicleUrl}/models`,
+ url: `${VEHICLE_BASE_URL}/models`,
method: 'GET'
},
GetVehicleStyles: {
- url: `${baseVehicleUrl}/styles`,
+ url: `${VEHICLE_BASE_URL}/styles`,
method: 'GET'
},
GetDamageOptions: {
- url: `${basePartsUrl}/damage-options`,
+ url: `${PARTS_BASE_URL}/damage-options`,
method: 'GET'
},
GetPartsOrQuestions: {
- url: `${basePartsUrl}/parts-or-questions`,
+ url: `${PARTS_BASE_URL}/parts-or-questions`,
method: 'POST'
},
GetParts: {
- url: `${basePartsUrl}/parts`,
+ url: `${PARTS_BASE_URL}/parts`,
method: 'POST'
},
// TODO finish
GetInsurancePriceOrderItems: {
- url: () => `${basePriceUrl}/order-items-with-insurance-pricing`,
+ url: `${PRICE_BASE_URL}/order-items-with-insurance-pricing`,
method: 'GET'
},
GetPriceOrderItems: {
- url: `${basePriceUrl}/order-items`,
+ url: `${PRICE_BASE_URL}/order-items`,
method: 'GET'
},
GetProviders: {
- url: `${baseLocationUrl}/providers`,
+ url: `${LOCATION_BASE_URL}/providers`,
method: 'GET'
},
GetCapabilityQuestions: {
- url: `${basePartsUrl}/capability-questions`,
+ url: `${PARTS_BASE_URL}/capability-questions`,
method: 'GET'
},
GetPartFromCapabilityAnswer: {
- url: `${basePartsUrl}/part-from-capability-answer`,
+ url: `${PARTS_BASE_URL}/part-from-capability-answer`,
method: 'POST'
},
GetWipers: {
- url: `${basePartsUrl}/wipers`,
+ url: `${PARTS_BASE_URL}/wipers`,
method: 'GET'
},
GetRainDefense: {
- url: `${basePartsUrl}/rain-defense`,
+ url: `${PARTS_BASE_URL}/rain-defense`,
method: 'GET'
},
GetSupportingItems: {
- url: `${basePartsUrl}/supporting-items`,
+ url: `${PARTS_BASE_URL}/supporting-items`,
method: 'POST'
},
GetMobileFeePart: {
- url: `${basePartsUrl}/mobile-fee`,
+ url: `${PARTS_BASE_URL}/mobile-fee`,
method: 'GET'
},
GetServiceabilityDetails: {
- url: `${baseLocationUrl}/serviceability-details`,
+ url: `${LOCATION_BASE_URL}/serviceability-details`,
method: 'GET'
},
GetVehicle: {
- url: `${baseVehicleUrl}/lookup`,
+ url: `${VEHICLE_BASE_URL}/lookup`,
method: 'GET'
},
GetAccountInfo: {
- url: baseAccountUrl,
+ url: `${ACCOUNT_BASE_URL}/`,
method: 'GET'
},
LogExperimentExposureIfAssigned: {
- url: `${baseExperimentsUrl}/log-exposure`,
+ url: `${EXPERIMENTS_BASE_URL}/log-exposure`,
method: 'POST'
},
LogPageView: {
- url: `${baseAnalyticsUrl}/log-page-view`,
+ url: `${ANALYTICS_BASE_URL}/log-page-view`,
method: 'POST'
},
LogCustomEvent: {
- url: `${baseAnalyticsUrl}/log-custom-event`,
+ url: `${ANALYTICS_BASE_URL}/log-custom-event`,
method: 'POST'
},
LookupVehicleByVin: {
- url: `${baseVehicleUrl}/lookup`,
+ url: `${VEHICLE_BASE_URL}/lookup`,
method: 'POST'
},
LookupVinByAddress: {
- url: `${baseVehicleUrl}/lookup-vin-by-address`,
+ url: `${VEHICLE_BASE_URL}/lookup-vin-by-address`,
method: 'POST'
},
LookupVinByPlate: {
- url: `${baseVehicleUrl}/lookup-vin-by-plate`,
+ url: `${VEHICLE_BASE_URL}/lookup-vin-by-plate`,
method: 'POST'
},
InitializeSession: {
- url: `${baseAnalyticsUrl}/initialize`,
+ url: `${ANALYTICS_BASE_URL}/initialize`,
method: 'POST'
},
GetExperimentsByUser: {
- url: `${baseAnalyticsUrl}/get-experiments`,
+ url: `${ANALYTICS_BASE_URL}/get-experiments`,
method: 'GET'
},
RunExperimentsForTrigger: {
- url: `${baseExperimentsUrl}/run`,
+ url: `${EXPERIMENTS_BASE_URL}/run`,
method: 'POST'
},
ValidateZip: {
- url: `${baseLocationUrl}/zip`,
+ url: `${LOCATION_BASE_URL}/zip`,
method: 'GET'
},
GooglePlaces: {
url: (apiKey) => `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places`
},
ValidateClientTag: {
- url: `${baseClientAuthUrl}/validate-client-tag`,
+ url: `${CLIENT_AUTH_BASE_URL}/validate-client-tag`,
method: 'GET'
},
ValidateClientSignature: {
- url: `${baseClientAuthUrl}/validate-client-signature`,
+ url: `${CLIENT_AUTH_BASE_URL}/validate-client-signature`,
method: 'POST'
},
IsVinbyAddressPermissible: {
- url: `${baseVehicleUrl}/is-vin-by-address-permissible`,
+ url: `${VEHICLE_BASE_URL}/is-vin-by-address-permissible`,
method: 'Get'
},
CoveragePolicyInfo: {
- url: `${baseCoverageUrl}/policy-information`,
+ url: `${COVERAGE_BASE_URL}/policy-information`,
method: 'POST'
},
RegisterClaim: {
- url: `${baseCoverageUrl}/register-claim`,
+ url: `${COVERAGE_BASE_URL}/register-claim`,
method: 'POST'
},
SaveSession: {
- url: `${baseOrderUrl}/save-session/iss`,
+ url: `${ORDER_BASE_URL}/save-session/iss`,
method: 'POST'
},
LoadSession: {
- url: `${baseOrderUrl}/load-session`,
+ url: `${ORDER_BASE_URL}/load-session/iss`,
method: 'POST'
},
DuplicateSearch: {
// eslint-disable-next-line max-len
- url: (accountNumber, policyNumber, dateOfLoss) => `${baseOrderUrl}/duplicate-check/${accountNumber}/${policyNumber}/${dateOfLoss}`,
+ url: (accountNumber, policyNumber, dateOfLoss) => `${ORDER_BASE_URL}/duplicate-check/${accountNumber}/${policyNumber}/${dateOfLoss}`,
method: 'GET'
},
FinalDeductible: {
- url: `${baseCoverageUrl}/final-deductible`,
+ url: `${COVERAGE_BASE_URL}/final-deductible`,
method: 'POST'
},
GetPaymentSignature: {
- url: `${baseOrderUrl}/sign`,
+ url: `${ORDER_BASE_URL}/sign`,
method: 'POST'
}
});
diff --git a/src/helpers/date-helper.js b/src/helpers/date-helper.js
index 1b062c85..be8161e8 100644
--- a/src/helpers/date-helper.js
+++ b/src/helpers/date-helper.js
@@ -72,3 +72,35 @@ export function sumDateString(dateString, daysToAdd) {
date.setDate(date.getDate() + daysToAdd);
return convertDateToDateString(date);
}
+
+export function get12HourTimeMobileFormat(time) {
+ // Check correct time format and split into components
+ let timeString = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time];
+
+ if (timeString.length > 1) {
+ // If time format correct
+ const min = timeString[3];
+ timeString = timeString.slice(1); // Remove full string match value
+ if (Number(min) === 0) {
+ timeString = timeString.slice(0, 1); // Remove minute value
+ timeString[1] = +timeString[0] < 12 ? ' AM' : ' PM'; // Set AM/PM
+ } else {
+ timeString[5] = +timeString[0] < 12 ? ' AM' : ' PM'; // Set AM/PM
+ }
+ timeString[0] = +timeString[0] % 12 || 12; // Adjust hours
+ }
+ return timeString.join(''); // return adjusted time or original string
+}
+
+export function get12HourTimeFormat(time) {
+ // Check correct time format and split into components
+ let timeString = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)?$/) || [time];
+
+ if (timeString.length > 1) {
+ // If time format correct
+ timeString = timeString.slice(1); // Remove full string match value
+ timeString[5] = +timeString[0] < 12 ? ' AM' : ' PM'; // Set AM/PM
+ timeString[0] = +timeString[0] % 12 || 12; // Adjust hours
+ }
+ return timeString.join(''); // return adjusted time or original string
+}
diff --git a/src/helpers/order-helper.js b/src/helpers/order-helper.js
index 0b89d8e5..85d0bec2 100644
--- a/src/helpers/order-helper.js
+++ b/src/helpers/order-helper.js
@@ -24,6 +24,8 @@ export async function saveSession({ shouldAwaitSaveSessionQueue = false }) {
*/
async function saveSessionHelper(store) {
const savedSessionInfo = await store.saveSession();
- store.setSaveSessionInfo(savedSessionInfo.data);
+ if (savedSessionInfo) {
+ store.setSaveSessionInfo(savedSessionInfo.data);
+ }
updateOrCreateISSCookie();
}
\ No newline at end of file
diff --git a/src/helpers/policy-vehicle-helper.js b/src/helpers/policy-vehicle-helper.js
new file mode 100644
index 00000000..69a80e74
--- /dev/null
+++ b/src/helpers/policy-vehicle-helper.js
@@ -0,0 +1,23 @@
+import endorsementOptions from '@/constants/endorsement-options';
+
+export function noCoverageForSelectedVehicle(vehicle) {
+ return (vehicle?.coverages?.length ?? 0) === 0;
+}
+export function deductibleForSelectedVehicle(vehicle) {
+ if (!vehicle) {
+ return undefined;
+ }
+
+ return vehicle.coverages?.length ?? false
+ ? vehicle?.coverages[0].deductible
+ : 0;
+}
+export function endorsementsForSelectedVehicle(vehicle) {
+ if (vehicle?.endorsements?.length > 0) {
+ return vehicle.endorsements;
+ }
+ return [];
+}
+export function repairWaivedForSelectedVehicle(vehicle) {
+ return vehicle?.endorsements?.includes(endorsementOptions.REPAIR_WAIVED) ?? false;
+}
diff --git a/src/helpers/policy-vehicle-helper.spec.js b/src/helpers/policy-vehicle-helper.spec.js
new file mode 100644
index 00000000..be3411b3
--- /dev/null
+++ b/src/helpers/policy-vehicle-helper.spec.js
@@ -0,0 +1,205 @@
+import {
+ deductibleForSelectedVehicle,
+ endorsementsForSelectedVehicle,
+ noCoverageForSelectedVehicle,
+ repairWaivedForSelectedVehicle
+} from '@/helpers/policy-vehicle-helper';
+import { getRandomInt, getRandomString } from '@/helpers/data-generation';
+import endorsementOptions from '@/constants/endorsement-options';
+
+describe('policy vehicle helper', () => {
+ describe('noCoverageForSelectedVehicle function', () => {
+ it('Null vehicle => returns true', async () => {
+ // Arrange
+ const vehicle = null;
+
+ // Act
+ const result = noCoverageForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeTruthy();
+ });
+
+ it('Empty vehicle coverages list => returns true', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ coverages: []
+ };
+
+ // Act
+ const result = noCoverageForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeTruthy();
+ });
+
+ it('Non-empty vehicle coverages list => returns false', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ coverages: [
+ {
+ deductible: 0
+ }
+ ]
+ };
+
+ // Act
+ const result = deductibleForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeFalsy();
+ });
+ });
+
+ describe('deductibleForSelectedVehicle function', () => {
+ it('Null vehicle => returns undefined', async () => {
+ // Arrange
+ const vehicle = null;
+
+ // Act
+ const result = deductibleForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBe(undefined);
+ });
+
+ it('Vehicle match with empty coverages list => 0 returned', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ coverages: []
+ };
+
+ // Act
+ const result = deductibleForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBe(0);
+ });
+
+ it('Coverages list non empty => deductible from first coverage returned', async () => {
+ // Arrange
+ const firstDeductible = getRandomInt(1, 1000);
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ coverages: [
+ {
+ deductible: firstDeductible
+ },
+ {
+ deductible: getRandomInt(1, 1000)
+ }
+ ]
+ };
+
+ // Act
+ const result = deductibleForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBe(firstDeductible);
+ });
+ });
+
+ describe('repairWaivedForSelectedVehicle function', () => {
+ it('Null vehicle => returns false', async () => {
+ // Arrange
+ const vehicle = null;
+
+ // Act
+ const result = repairWaivedForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeFalsy();
+ });
+
+ it('Endorsements list empty => false returned', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ endorsements: []
+ };
+
+ // Act
+ const result = repairWaivedForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeFalsy();
+ });
+
+ it('Endorsements list non-empty, not containing repair waived => false returned', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ endorsements: [endorsementOptions.EDUCATOR, endorsementOptions.PARKING_GUARD]
+ };
+
+ // Act
+ const result = repairWaivedForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeFalsy();
+ });
+
+ it('Endorsements list contains repair waived => true returned', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ endorsements: [
+ endorsementOptions.EDUCATOR,
+ endorsementOptions.REPAIR_WAIVED,
+ endorsementOptions.PARKING_GUARD
+ ]
+ };
+
+ // Act
+ const result = repairWaivedForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toBeTruthy();
+ });
+ });
+
+ describe('endorsementsForSelectedVehicle function', () => {
+ it('Null vehicle => returns empty array', async () => {
+ // Arrange
+ const vehicle = null;
+
+ // Act
+ const result = endorsementsForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toStrictEqual([]);
+ });
+
+ it('Null endorsements => returns empty array', async () => {
+ // Arrange
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ endorsements: null
+ };
+
+ // Act
+ const result = endorsementsForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toStrictEqual([]);
+ });
+
+ it('Endorsements list non-empty, not containing repair waived => false returned', async () => {
+ // Arrange
+ const endorsements = [endorsementOptions.EDUCATOR, endorsementOptions.PARKING_GUARD];
+ const vehicle = {
+ vin: getRandomString(17, 17),
+ endorsements
+ };
+
+ // Act
+ const result = endorsementsForSelectedVehicle(vehicle);
+
+ // Assert
+ expect(result).toStrictEqual(endorsements);
+ });
+ });
+});
diff --git a/src/layouts/coverage-statement/coverage-statement.spec.js b/src/layouts/coverage-statement/coverage-statement.spec.js
index 041ea60c..a597b7f9 100644
--- a/src/layouts/coverage-statement/coverage-statement.spec.js
+++ b/src/layouts/coverage-statement/coverage-statement.spec.js
@@ -829,7 +829,7 @@ describe.skip('coverageStatement.vue', () => {
describe('coverageStatement.vue-working', () => {
describe('ITAC flag', () => {
- test('ITAC flag updated once component is initialized', () => {
+ test('ITAC flag updated once component is initialized', async () => {
// Arrange
const mainInitialState = {
order: {
@@ -838,7 +838,10 @@ describe('coverageStatement.vue-working', () => {
}
}
};
- const { wrapper } = getMountedComponent(mainInitialState);
+ const mockStoreActions = () => {
+ useMainStore().getPriceOrderItems = jest.fn().mockImplementation(() => Promise.resolve([]));
+ };
+ const { wrapper } = getMountedComponent(mainInitialState, {}, mockStoreActions);
// Act
wrapper.vm.initializeComponent();
@@ -847,5 +850,57 @@ describe('coverageStatement.vue-working', () => {
expect(wrapper.vm.mainStore.updatePolicyITACFlag)
.toHaveBeenCalledTimes(1);
});
+
+ it('Loaded duplicate with previously registered claim => claim registration is not called', async () => {
+ // Arrange
+ const sellingPrice = getRandomInt(50, 100);
+ const deductible = sellingPrice - 1;
+ const initialStore = {
+ order: {
+ policy: {
+ policyLookupSuccessful: true,
+ noCoverage: false,
+ deductible: {
+ repair: deductible
+ }
+ },
+ damage: {
+ isRepair: false
+ },
+ payment: {
+ insuranceCoverage: {
+ claimNumber: getRandomString(10, 10)
+ }
+ }
+ },
+ issConfig: {
+ isClaimRegistrationRequired: true
+ }
+ };
+ const mockStoreActions = () => {
+ useMainStore().getWipers = jest.fn().mockImplementation(() => Promise.resolve());
+ useMainStore().getRainDefense = jest.fn().mockImplementation(() => Promise.resolve());
+ useMainStore().getSupportingItems = jest.fn().mockImplementation(() => Promise.resolve());
+ useMainStore().getPriceOrderItems = jest.fn().mockImplementation(() => Promise.resolve([
+ {
+ sellingPrice,
+ kitPrice: 0,
+ laborAmount: 0
+ }
+ ]));
+ };
+ const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions);
+ const next = (method) => { method(wrapper.vm); };
+
+ // Act
+ coverageStatement.beforeRouteEnter.call(wrapper.vm, undefined, undefined, next);
+ for (let i = 0; i < 7; i++) {
+ // eslint-disable-next-line no-await-in-loop
+ await nextTick();
+ }
+
+ // Assert
+ expect(wrapper.vm.mainStore.registerClaim).toHaveBeenCalledTimes(0);
+ });
});
});
diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue
index 1e5efb02..00a84f1a 100644
--- a/src/layouts/coverage-statement/coverage-statement.vue
+++ b/src/layouts/coverage-statement/coverage-statement.vue
@@ -367,9 +367,10 @@ export default {
: coverageStatuses.PENDING;
useMainStore().updateCoverageStatus(coverageStatus);
if (this.policyLookupSuccessful
- && useMainStore().order.vehicle.policyVehicleId >= 0
- && useMainStore().isClaimRegistrationRequired
- && (this.coveredAndServicePriceAboveOrEqualDeductible || this.verifiedITAC)) {
+ && useMainStore().order.vehicle.policyVehicleId >= 0
+ && useMainStore().isClaimRegistrationRequired
+ && !useMainStore().isClaimAlreadyRegistered
+ && (this.coveredAndServicePriceAboveOrEqualDeductible || this.verifiedITAC)) {
await useMainStore().registerClaim()?.catch(() => {});
}
this.$refs.loadingModal.hideModal();
diff --git a/src/layouts/duplicate-check/duplicate-check.spec.js b/src/layouts/duplicate-check/duplicate-check.spec.js
index 66d2c3e1..13d00c9f 100644
--- a/src/layouts/duplicate-check/duplicate-check.spec.js
+++ b/src/layouts/duplicate-check/duplicate-check.spec.js
@@ -519,6 +519,110 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED, undefined);
});
+ test('policyLookupSuccessful true and loaded duplicate with policy vehicle => CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE', async () => {
+ // Arrange
+ const mountOptions = getMountOptions({
+ router: { navigate: jest.fn() }
+ });
+
+ const vin = getRandomString(17, 17);
+ const mainInitialState = {
+ order: {
+ policy: {
+ policyLookupSuccessful: true,
+ vehicles: [{ vin }]
+ },
+ vehicle: {
+ vin
+ },
+ loadedFromDupeCheck: true
+ }
+ };
+ mountOptions.global.plugins = [createTestingPinia({
+ initialState: {
+ main: mainInitialState
+ }
+ })];
+
+ const wrapper = shallowMount(duplicateCheck, mountOptions);
+
+ // Act
+ await wrapper.vm.forwardButtonAction();
+
+ // Assert
+ expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
+ expect(wrapper.vm.$router.navigate)
+ .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE, undefined);
+ });
+ test('policyLookupSuccessful true and loaded duplicate with non policy vehicle => CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE', async () => {
+ // Arrange
+ const mountOptions = getMountOptions({
+ router: { navigate: jest.fn() }
+ });
+
+ const vin = getRandomString(17, 17);
+ const mainInitialState = {
+ order: {
+ policy: {
+ policyLookupSuccessful: true,
+ vehicles: [{ vin }]
+ },
+ vehicle: {
+ vin: null
+ },
+ loadedFromDupeCheck: true
+ }
+ };
+ mountOptions.global.plugins = [createTestingPinia({
+ initialState: {
+ main: mainInitialState
+ }
+ })];
+
+ const wrapper = shallowMount(duplicateCheck, mountOptions);
+
+ // Act
+ await wrapper.vm.forwardButtonAction();
+
+ // Assert
+ expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
+ expect(wrapper.vm.$router.navigate)
+ .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE, undefined);
+ });
+ test('policyLookupSuccessful true and loaded duplicate with no policy vehicles => CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES', async () => {
+ // Arrange
+ const mountOptions = getMountOptions({
+ router: { navigate: jest.fn() }
+ });
+
+ const mainInitialState = {
+ order: {
+ policy: {
+ policyLookupSuccessful: true,
+ vehicles: []
+ },
+ vehicle: {
+ vin: null
+ },
+ loadedFromDupeCheck: true
+ }
+ };
+ mountOptions.global.plugins = [createTestingPinia({
+ initialState: {
+ main: mainInitialState
+ }
+ })];
+
+ const wrapper = shallowMount(duplicateCheck, mountOptions);
+
+ // Act
+ await wrapper.vm.forwardButtonAction();
+
+ // Assert
+ expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
+ expect(wrapper.vm.$router.navigate)
+ .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES, undefined);
+ });
});
});
});
diff --git a/src/layouts/duplicate-check/duplicate-check.vue b/src/layouts/duplicate-check/duplicate-check.vue
index cf228be8..7245adef 100644
--- a/src/layouts/duplicate-check/duplicate-check.vue
+++ b/src/layouts/duplicate-check/duplicate-check.vue
@@ -135,9 +135,17 @@ export default {
}
},
navigateForward() {
- if (useMainStore().order.policy.policyLookupSuccessful) {
- const policyVehicles = useMainStore().order.policy.vehicles ?? [];
- if (policyVehicles.length > 0) {
+ if (!this.mainStore.order.policy.policyLookupSuccessful) {
+ this.$router.navigate(
+ this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
+ this.$route
+ );
+ return;
+ }
+
+ const policyVehicles = useMainStore().order.policy.vehicles ?? [];
+ if (!this.mainStore.order.loadedFromDupeCheck) {
+ if (policyVehicles.length !== 0) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
this.$route
@@ -148,9 +156,22 @@ export default {
this.$route
);
}
+ return;
+ }
+
+ if (this.mainStore.order.vehicle.vin) {
+ this.$router.navigate(
+ this.navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_POLICY_VEHICLE,
+ this.$route
+ );
+ } else if (policyVehicles.length !== 0) {
+ this.$router.navigate(
+ this.navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NON_POLICY_VEHICLE,
+ this.$route
+ );
} else {
this.$router.navigate(
- this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
+ this.navigationScenarios.CLICKED_FORWARD_LOADED_DUPLICATE_WITH_NO_POLICY_VEHICLES,
this.$route
);
}
diff --git a/src/layouts/order-confirmation/order-confirmation.spec.js b/src/layouts/order-confirmation/order-confirmation.spec.js
index fe981266..590b5c1b 100644
--- a/src/layouts/order-confirmation/order-confirmation.spec.js
+++ b/src/layouts/order-confirmation/order-confirmation.spec.js
@@ -14,10 +14,11 @@ jest.mock('@/helpers/layout-helper.js', () => jest.fn());
jest.mock('@/helpers/cms-content-helper', () => ({
fetchCmsContentForPage: jest.fn()
}));
+const wordingText = 'wording Text {custom:address}';
const mockMixin = {
methods: {
- getCmsContent: jest.fn().mockImplementation(() => ''),
+ getCmsContent: jest.fn().mockImplementation(() => wordingText),
setCmsContent: jest.fn()
}
};
@@ -33,6 +34,32 @@ const headerStub = {
render: () => {}
};
+const initialStore = {
+ order: {
+ schedule: {
+ date: '2024-03-01',
+ startTime: '09:00',
+ endTime: '10:00'
+ },
+ serviceLocation: {
+ address: '123 Test Way',
+ address2: '#1',
+ city: 'Mesa',
+ state: 'AZ',
+ zipCode: '12345',
+ appointmentType: 'Inshop',
+ provider: {
+ address: {
+ streetAddress: '123 Safelite Street',
+ city: 'Mesa',
+ state: 'AZ',
+ zipCode: '12345'
+ }
+ }
+ }
+ }
+};
+
function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) {
const mountOptions = getMountOptions({
router: {
@@ -75,7 +102,7 @@ describe('OrderConfirmation.vue', () => {
describe('Rendering', () => {
test('Should render Site Header', () => {
// Arrange
- const { wrapper } = getMountedComponent({});
+ const { wrapper } = getMountedComponent(initialStore);
// Act
const siteHeader = wrapper.findComponent(headerStub);
@@ -85,13 +112,21 @@ describe('OrderConfirmation.vue', () => {
});
test('If Advanced flow, should display Site Footer', () => {
// Arrange
- const carrierReturnUrl = 'testURL';
- const initialStore = {
+ const testStore = {
+ order: {
+ schedule: {
+ date: '2019-01-01',
+ startTime: '09:00'
+ },
+ serviceLocation: {
+ appointmentType: 'Inshop'
+ }
+ },
issConfig: {
- successReturnURL: carrierReturnUrl
+ successReturnURL: 'testURL'
}
};
- const { wrapper } = getMountedComponent(initialStore);
+ const { wrapper } = getMountedComponent(testStore);
// Act
const siteFooter = wrapper.findComponent({ ref: 'siteFooter' });
@@ -101,7 +136,7 @@ describe('OrderConfirmation.vue', () => {
});
test('If Essential flow, should not display Site Footer', () => {
// Arrange
- const { wrapper } = getMountedComponent();
+ const { wrapper } = getMountedComponent(initialStore);
// Act
const siteFooter = wrapper.findComponent({ ref: 'siteFooter' });
@@ -114,12 +149,21 @@ describe('OrderConfirmation.vue', () => {
test('If Advanced flow, forward button action navigates to carrier URL', () => {
// Arrange
const carrierReturnUrl = 'testURL';
- const initialStore = {
+ const testStore = {
+ order: {
+ schedule: {
+ date: '2019-01-01',
+ startTime: '09:00'
+ },
+ serviceLocation: {
+ appointmentType: 'Inshop'
+ }
+ },
issConfig: {
successReturnURL: carrierReturnUrl
}
};
- const { wrapper } = getMountedComponent(initialStore);
+ const { wrapper } = getMountedComponent(testStore);
// Act
wrapper.vm.forwardButtonAction();
@@ -128,4 +172,157 @@ describe('OrderConfirmation.vue', () => {
expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl);
});
});
+ describe('Computed properties', () => {
+ test('appointmentDateFormatted should return date in expected format', () => {
+ // Arrange
+ const { wrapper } = getMountedComponent(initialStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentDateFormatted;
+
+ // Assert
+ expect(testValue).toEqual('Friday, March 1');
+ });
+ test('appointmentTimeFormatted should return Mobile time in expected format', () => {
+ // Arrange
+ const testStore = {
+ order: {
+ schedule: {
+ date: '2019-01-01',
+ startTime: '09:00',
+ endTime: '10:00'
+ },
+ serviceLocation: {
+ appointmentType: 'Mobile'
+ }
+ }
+ };
+ const { wrapper } = getMountedComponent(testStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentTimeFormatted;
+
+ // Assert
+ expect(testValue).toEqual('Between 9 AM - 10 AM');
+ });
+ test('appointmentTimeFormatted should return Drop Off time in expected format', () => {
+ // Arrange
+ const testStore = {
+ order: {
+ schedule: {
+ date: '2019-01-01',
+ startTime: '09:00',
+ endTime: '10:00'
+ },
+ serviceLocation: {
+ appointmentType: 'Drop Off'
+ }
+ }
+ };
+ const { wrapper } = getMountedComponent(testStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentTimeFormatted;
+
+ // Assert
+ expect(testValue).toEqual('Drop off before 9:30 AM');
+ });
+ test('appointmentTimeFormatted should return In Shop time in expected format', () => {
+ // Arrange
+ const { wrapper } = getMountedComponent(initialStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentTimeFormatted;
+
+ // Assert
+ expect(testValue).toEqual('at 9:00 AM');
+ });
+ test('appointmentWordingText should return Mobile text in expected format', () => {
+ // Arrange
+ const testStore = {
+ order: {
+ schedule: {
+ date: '2019-01-01',
+ startTime: '09:00',
+ endTime: '10:00'
+ },
+ serviceLocation: {
+ address: '123 Test Way',
+ address2: '#1',
+ city: 'Mesa',
+ state: 'AZ',
+ zipCode: '12345',
+ appointmentType: 'Mobile'
+ }
+ }
+ };
+ const { wrapper } = getMountedComponent(testStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentWordingText;
+
+ // Assert
+ expect(testValue).toEqual('wording Text
123 Test Way, #1,
Mesa, AZ 12345
');
+ });
+ test('appointmentWordingText should return Drop Off text in expected format', () => {
+ // Arrange
+ const testStore = {
+ order: {
+ schedule: {
+ date: '2019-01-01',
+ startTime: '09:00',
+ endTime: '10:00'
+ },
+ serviceLocation: {
+ provider: {
+ address: {
+ streetAddress: '123 Safelite Street',
+ city: 'Mesa',
+ state: 'AZ',
+ zipCode: '12345'
+ }
+ },
+ appointmentType: 'Drop Off'
+ }
+ }
+ };
+ const { wrapper } = getMountedComponent(testStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentWordingText;
+
+ // Assert
+ expect(testValue).toEqual('wording Text
123 Safelite Street,
Mesa, AZ 12345
');
+ });
+ test('appointmentWordingText should return In Shop text in expected format', () => {
+ // Arrange
+ const { wrapper } = getMountedComponent(initialStore);
+
+ // Act
+ const testValue = wrapper.vm.appointmentWordingText;
+
+ // Assert
+ expect(testValue).toEqual('wording Text
123 Safelite Street,
Mesa, AZ 12345
');
+ });
+ test('serviceLocationFullAddress should return text in expected format', () => {
+ // Arrange
+ const { wrapper } = getMountedComponent(initialStore);
+
+ // Act
+ const testValue = wrapper.vm.serviceLocationFullAddress;
+
+ // Assert
+ expect(testValue).toEqual('
123 Test Way, #1,
Mesa, AZ 12345
');
+ });
+ test('providerFullAddress should return text in expected format', () => {
+ // Arrange
+ const { wrapper } = getMountedComponent(initialStore);
+
+ // Act
+ const testValue = wrapper.vm.providerFullAddress;
+
+ // Assert
+ expect(testValue).toEqual('
123 Safelite Street,
Mesa, AZ 12345
');
+ });
+ });
});
diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue
index 57c8de44..38f2dc9e 100644
--- a/src/layouts/order-confirmation/order-confirmation.vue
+++ b/src/layouts/order-confirmation/order-confirmation.vue
@@ -7,12 +7,34 @@
Placeholder for order confirmation page
+{{ appointmentDateFormatted }}
+{{ appointmentTimeFormatted }}
+