Merge pull request #461 from Safelite/feature/richardson/SSR-643.2

Mobile Options based on iTAC flag
This commit is contained in:
brich1212safe 2023-09-29 18:06:48 -04:00 committed by GitHub
commit 1d3ba7d381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 235 additions and 210 deletions

View file

@ -1,6 +1,7 @@
const AppointmentTypeStrings = {
IN_SHOP: 'Inshop',
MOBILE: 'Mobile',
MOBILE_INSURANCE: 'Mobile-Insurance',
DROP_OFF: 'Dropoff'
};
const PREMIUM_FEE_PART_TYPE = 'EARLY BIRD';

View file

@ -795,3 +795,26 @@ describe.skip('coverageStatement.vue', () => {
});
});
});
describe('coverageStatement.vue-working', () => {
describe('Navigation', () => {
test('Function called on any FORWARD navigation', () => {
// Arrange
const mainInitialState = {
order: {
policy: {
isITAC: null
}
}
};
const { wrapper } = getMountedComponent(mainInitialState);
// Act
wrapper.vm.forwardButtonAction();
// Assert
expect(wrapper.vm.mainStore.updatePolicyITACFlag)
.toHaveBeenCalledTimes(1);
});
});
});

View file

@ -140,8 +140,6 @@ export default {
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to?.query?.issPage);
const wipersPromise = await useMainStore().getWipers();
const rainDefensePromise = await useMainStore().getRainDefense();
const supportingItemsPromise = await useMainStore().getSupportingItems();
// Settle promises and get results
@ -150,14 +148,6 @@ export default {
resultKey: 'cmsContent',
promise: cmsContentPromise
},
{
resultKey: 'wipers',
promise: wipersPromise
},
{
resultKey: 'rainDefense',
promise: rainDefensePromise
},
{
resultKey: 'supportingItems',
promise: supportingItemsPromise
@ -169,9 +159,7 @@ export default {
? JSON.parse(JSON.stringify(useMainStore().order.lineItems.glassParts))
: [];
const availableLineItems = [
resultMap.rainDefense,
...(resultMap.supportingItems ?? []),
...(resultMap.wipers ?? []),
...(clonedGlassParts ?? [])
];
@ -357,6 +345,7 @@ export default {
return this.navigateForward();
},
async navigateForward() {
useMainStore().updatePolicyITACFlag(this.verifiedITAC);
if (this.unverified || this.verifiedDeductible) {
this.mainStore.saveSupportingItems(this.supportingItems);
this.$router.navigate(

View file

@ -51,13 +51,15 @@ export default {
return this.getCmsContent(this.cmsWidgetName, 'Answers');
},
answersToDisplay() {
const shouldShowMobile = this.isServiceableMobile;
const shouldShowMobile = this.isServiceableMobile && this.isITAC;
const shouldShowMobileInsurance = this.isServiceableMobile && !this.isITAC;
const shouldShowInshop = this.isServiceableInshop;
const shouldShowDropoff = this.isServiceableInshop && !useMainStore().damage.isRepair;
return this.answersFromCms
? this.answersFromCms.filter((answer) => (
(answer.Name === AppointmentTypeStrings.IN_SHOP && shouldShowInshop)
|| (answer.Name === AppointmentTypeStrings.MOBILE && shouldShowMobile)
|| (answer.Name === AppointmentTypeStrings.MOBILE_INSURANCE && shouldShowMobileInsurance)
|| (answer.Name === AppointmentTypeStrings.DROP_OFF && shouldShowDropoff)
))
: [];
@ -70,6 +72,9 @@ export default {
this.$emit('update:modelValue', newValue);
}
},
isITAC() {
return useMainStore().policy.isITAC;
},
isMobileOnly() {
return this.isServiceableMobile && !this.isServiceableInshop;
}
@ -80,9 +85,14 @@ export default {
// If there is only one option to display and that option is 'Mobile' then select it
if (
newValue.length === 1
&& newValue.findIndex((answer) => answer.Name === 'Mobile') !== -1
&& newValue.findIndex((answer) => (answer.Name === AppointmentTypeStrings.MOBILE
|| answer.Name === AppointmentTypeStrings.MOBILE_INSURANCE)) !== -1
) {
this.selectedValues = 'Mobile';
if (this.isITAC) {
this.selectedValues = AppointmentTypeStrings.MOBILE;
} else {
this.selectedValues = AppointmentTypeStrings.MOBILE_INSURANCE;
}
}
},
immediate: true
@ -90,7 +100,11 @@ export default {
isMobileOnly: {
handler(newValue) {
if (newValue) {
this.selectedValues = 'Mobile';
if (this.isITAC) {
this.selectedValues = AppointmentTypeStrings.MOBILE;
} else {
this.selectedValues = AppointmentTypeStrings.MOBILE_INSURANCE;
}
}
}
}

View file

@ -31,6 +31,7 @@
</span>
</div>
<textBlock
v-if="isITAC"
:customText="mobileFeeText"
cmsWidgetName="MobileFeeDisclaimerWidget"
typeStyle="caption" />
@ -81,6 +82,7 @@ import addressQuestions from '@/iss-components/address-questions/address-questio
import vehicleProtectedQuestion from '@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question.vue';
// Helpers
import { useMainStore } from '@/store';
import {
getPricedMobileFeePart,
getServiceabilityDetails,
@ -167,6 +169,9 @@ export default {
};
},
computed: {
isITAC() {
return useMainStore().policy.isITAC;
},
mobileLocationLinkPromptText() {
return this.getCmsContent(this.linkWidgetName, 'HeaderText');
},

View file

@ -59,7 +59,7 @@
cmsWidgetName="AppointmentTypeQuestionWidget"
validationRules="option-required" />
<mobileLocationModalQuestions
v-if="selectedAppointmentType === 'Mobile'"
v-if="isMobileLocationDisplayed"
ref="mobileLocationQuestions"
v-model="mobileLocationQuestions"
customComponentId="mobileLocationQuestions"
@ -94,6 +94,7 @@
</template>
<script>
// Import Supporting Files
import { AppointmentTypeStrings } from '@/constants/schedule-constants.js';
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import settleAllPromises from '@/helpers/layout-helper';
import { required } from '@/helpers/validation-rules';
@ -260,7 +261,8 @@ export default {
this.isVehicleProtected = newValue.isVehicleProtected;
if (newValue.zipCode !== this.zipCode) {
if (!this.selectedAppointmentType === 'Mobile') {
if (!(this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_INSURANCE)) {
this.selectedAppointmentType = null;
}
this.selectedProvider = null;
@ -289,6 +291,10 @@ export default {
isAppointmentTypeDisplayed() {
return this.zipCode && !this.displayNoShopsAlert;
},
isMobileLocationDisplayed() {
return this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_INSURANCE;
},
requiresInshopRecalibration() {
// Specifically check for isRecalibrationServiceableMobile === false, not null or true.
return (

View file

@ -48,6 +48,7 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import textLink from '@/ux-components/text-link/text-link.vue';
// Supporting files
import { AppointmentTypeStrings } from '@/constants/schedule-constants.js';
import baseMixin from '@/mixins/base-mixin.js';
import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
@ -141,7 +142,7 @@ export default {
await nextTick();
if (newValue !== 'Mobile') {
if (newValue !== AppointmentTypeStrings.MOBILE && newValue !== AppointmentTypeStrings.MOBILE_INSURANCE) {
this.getNextShopsFromList();
}
}

View file

@ -60,6 +60,7 @@ const getDefaultState = () => ({
repair: null, // numerical value; how much customer owes on deductible in repair case
replace: null // numerical value; how much customer owes on deductible in replace case,
},
isITAC: null,
vehicles: [],
endorsementQuestionAnswers: null
},
@ -1263,6 +1264,9 @@ export const useMainStore = defineStore({
this.order.customer.lastName = customerQuestions.lastName;
this.order.serviceLocation.zipCode = customerQuestions.addressQuestions.zipCode;
},
updatePolicyITACFlag(isITAC) {
this.order.policy.isITAC = isITAC;
},
savePartQuestionAnswers(partQuestionAnswersArray) {
// if part question answers have changed, reset subsequent question answers
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(this.order.damage.partQuestionAnswers, 'result');
@ -1670,6 +1674,7 @@ export const useMainStore = defineStore({
this.order.policy.damageCause = null;
this.order.policy.damageCity = null;
this.order.policy.damageState = null;
this.order.policy.isITAC = null;
this.order.customer.phoneNumber = null;
this.order.customer.emailAddress = null;
this.order.customer.firstName = null;

View file

@ -492,16 +492,14 @@ describe('Store', () => {
store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
method: endpoints.SaveSession.method,
endpoint: endpoints.SaveSession.url
}
));
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
method: endpoints.SaveSession.method,
endpoint: endpoints.SaveSession.url
}));
});
it('Returns expected response object', async () => {
// Arrange
var response = { ReferralNumber: getRandomString(6, 6) };
const response = { ReferralNumber: getRandomString(6, 6) };
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve(response));
// Act
@ -509,10 +507,10 @@ describe('Store', () => {
// Asserts
await expect(result).resolves.toBe(response);
})
});
it('calls api with expected application user data', () => {
// Arrange
var applicationUser = {
const applicationUser = {
crmCustomerId: getRandomString(6, 6),
experiments: getRandomString(6, 6),
lastPageVisited: getRandomString(6, 6),
@ -526,22 +524,20 @@ describe('Store', () => {
const result = store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
applicationUser: expect.objectContaining({
crmCustomerId: applicationUser.crmCustomerId,
experiments: applicationUser.experiments,
lastPage: applicationUser.lastPageVisited,
pageData: applicationUser.pageData,
savedSessionId: applicationUser.savedSessionId
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
applicationUser: expect.objectContaining({
crmCustomerId: applicationUser.crmCustomerId,
experiments: applicationUser.experiments,
lastPage: applicationUser.lastPageVisited,
pageData: applicationUser.pageData,
savedSessionId: applicationUser.savedSessionId
})
})
);
}));
});
it('calls api with expected vehicle', () => {
var vehicle = {
const vehicle = {
year: getRandomString(6, 6),
make: getRandomString(6, 6),
model: getRandomString(6, 6),
@ -557,25 +553,23 @@ describe('Store', () => {
store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
vehicle: expect.objectContaining({
year: vehicle.year,
make: vehicle.make,
model: vehicle.model,
style: vehicle.style,
carId: vehicle.carId,
vin: vehicle.vin,
licensePlateNumber: vehicle.registration.licensePlate
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
vehicle: expect.objectContaining({
year: vehicle.year,
make: vehicle.make,
model: vehicle.model,
style: vehicle.style,
carId: vehicle.carId,
vin: vehicle.vin,
licensePlateNumber: vehicle.registration.licensePlate
})
}
));
})
}));
});
it('calls api with expected damage', () => {
// Arrange
var damage = {
const damage = {
isRepair: getRandomString(6, 6),
numberOfChips: getRandomString(6, 6),
glassToReplace: [],
@ -583,7 +577,7 @@ describe('Store', () => {
moldingQuestionAnswers: getRandomString(6, 6),
capabilityQuestionAnswers: getRandomString(6, 6)
};
var policy = {
const policy = {
dateOfLoss: getRandomString(6, 6),
damageCause: getRandomString(6, 6),
damageState: getRandomString(6, 6),
@ -598,41 +592,39 @@ describe('Store', () => {
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
damage: expect.objectContaining({
numberOfChips: damage.numberOfChips,
isRepair: damage.isRepair,
partQuestionAnswers: damage.partQuestionAnswers,
moldingQuestionAnswers: damage.moldingQuestionAnswers,
capabilityQuestionAnswers: damage.capabilityQuestionAnswers,
dateOfLoss: policy.dateOfLoss,
damageCause: policy.damageCause,
damageState: policy.damageState,
damageCity: policy.damageCity,
isDamageGlassOnly: policy.isDamageGlassOnly
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
damage: expect.objectContaining({
numberOfChips: damage.numberOfChips,
isRepair: damage.isRepair,
partQuestionAnswers: damage.partQuestionAnswers,
moldingQuestionAnswers: damage.moldingQuestionAnswers,
capabilityQuestionAnswers: damage.capabilityQuestionAnswers,
dateOfLoss: policy.dateOfLoss,
damageCause: policy.damageCause,
damageState: policy.damageState,
damageCity: policy.damageCity,
isDamageGlassOnly: policy.isDamageGlassOnly
})
})
);
}));
});
it('calls api with expected policy', () => {
// Arrange
var customer = {
const customer = {
firstName: getRandomString(6, 6),
lastName: getRandomString(6, 6),
emailAddress: getRandomString(6, 6),
phoneNumber: getRandomString(6, 6)
};
var policy = {
const policy = {
policyNumber: getRandomString(6, 6),
policyZipCode: getRandomString(6, 6),
policyLookupSuccessful: getRandomString(6, 6),
noCoverage: getRandomString(6, 6)
};
var originalDeductible = getRandomString(6, 6);
var currentDeductible = getRandomString(6, 6);
const originalDeductible = getRandomString(6, 6);
const currentDeductible = getRandomString(6, 6);
store.order.originalDeductible = originalDeductible;
store.order.currentDeductible = currentDeductible;
store.order.customer = customer;
@ -643,30 +635,28 @@ describe('Store', () => {
store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
policy: expect.objectContaining({
policyHolder: expect.objectContaining({
policyFirstName: customer.firstName,
policyLastName: customer.lastName,
policyPhoneNumber: customer.phoneNumber,
policyEmail: customer.emailAddress
}),
policyNumber: policy.policyNumber,
policyZipCode: policy.policyZipCode,
noCoverage: policy.noCoverage,
policyLookupSuccessful: policy.policyLookupSuccessful,
originalDeductible,
currentDeductible
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
policy: expect.objectContaining({
policyHolder: expect.objectContaining({
policyFirstName: customer.firstName,
policyLastName: customer.lastName,
policyPhoneNumber: customer.phoneNumber,
policyEmail: customer.emailAddress
}),
policyNumber: policy.policyNumber,
policyZipCode: policy.policyZipCode,
noCoverage: policy.noCoverage,
policyLookupSuccessful: policy.policyLookupSuccessful,
originalDeductible,
currentDeductible
})
})
);
}));
});
it('calls api with expected customer', () => {
// Arrange
var customer = {
const customer = {
address: {
streetAddress: getRandomString(6, 6),
streetAddress2: getRandomString(6, 6),
@ -675,7 +665,7 @@ describe('Store', () => {
zipCode: getRandomString(6, 6)
}
};
var contactInfo = {
const contactInfo = {
firstName: getRandomString(6, 6),
lastName: getRandomString(6, 6),
emailAddress: getRandomString(6, 6),
@ -690,30 +680,28 @@ describe('Store', () => {
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
customer: expect.objectContaining({
address: expect.objectContaining({
streetAddress: customer.address.streetAddress,
streetAddress2: customer.address.streetAddress2,
city: customer.address.city,
state: customer.address.state,
zipCode: customer.address.zipCode
}),
emailAddress: contactInfo.emailAddress,
firstName: contactInfo.firstName,
lastName: contactInfo.lastName,
phoneNumber: contactInfo.phoneNumber,
optInSms: contactInfo.requestTextUpdates
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
customer: expect.objectContaining({
address: expect.objectContaining({
streetAddress: customer.address.streetAddress,
streetAddress2: customer.address.streetAddress2,
city: customer.address.city,
state: customer.address.state,
zipCode: customer.address.zipCode
}),
emailAddress: contactInfo.emailAddress,
firstName: contactInfo.firstName,
lastName: contactInfo.lastName,
phoneNumber: contactInfo.phoneNumber,
optInSms: contactInfo.requestTextUpdates
})
})
);
}));
});
it('calls api with expected lineItems', () => {
// Arrange
var lineItems = {
const lineItems = {
glassParts: getRandomString(6, 6),
supportingItems: getRandomString(6, 6),
vaps: getRandomString(6, 6)
@ -725,17 +713,15 @@ describe('Store', () => {
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
lineItems: expect.objectContaining({
glassParts: lineItems.glassParts,
supportingItems: lineItems.supportingItems,
vaps: lineItems.vaps
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
lineItems: expect.objectContaining({
glassParts: lineItems.glassParts,
supportingItems: lineItems.supportingItems,
vaps: lineItems.vaps
})
})
);
}));
});
it.each([
[coverageStatuses.PENDING],
@ -759,25 +745,23 @@ describe('Store', () => {
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
payment: expect.objectContaining({
InsuranceCoverage: expect.objectContaining({
isVerified: payment.insuranceCoverage.isVerified,
coverageStatus: coverageStatus
}),
isInsurance: payment.isInsurance,
parentAccountNumber: parentAccountNumber
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
payment: expect.objectContaining({
InsuranceCoverage: expect.objectContaining({
isVerified: payment.insuranceCoverage.isVerified,
coverageStatus
}),
isInsurance: payment.isInsurance,
parentAccountNumber
})
})
);
}));
});
it('calls api with expected service location', () => {
// Arrange
var notesForTechnician = getRandomString(6, 6);
var serviceLocation = {
const notesForTechnician = getRandomString(6, 6);
const serviceLocation = {
address: getRandomString(6, 6),
city: getRandomString(6, 6),
state: getRandomString(6, 6),
@ -792,26 +776,24 @@ describe('Store', () => {
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
serviceLocation: expect.objectContaining({
address: expect.objectContaining({
streetAddress: serviceLocation.address,
city: serviceLocation.city,
state: serviceLocation.state,
zipCode: serviceLocation.zipCode,
zipCodeCtu: serviceLocation.zipCodeCtu
}),
techNotes: notesForTechnician
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
serviceLocation: expect.objectContaining({
address: expect.objectContaining({
streetAddress: serviceLocation.address,
city: serviceLocation.city,
state: serviceLocation.state,
zipCode: serviceLocation.zipCode,
zipCodeCtu: serviceLocation.zipCodeCtu
}),
techNotes: notesForTechnician
})
})
);
}));
});
it('calls api with expected schedule', () => {
// Arrange
var schedule = {
const schedule = {
date: getRandomString(6, 6),
startTime: getRandomString(6, 6),
endTime: getRandomString(6, 6),
@ -825,51 +807,45 @@ describe('Store', () => {
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
schedule: expect.objectContaining({
date: schedule.date,
startTime: schedule.startTime,
endTime: schedule.endTime,
routeCode: schedule.routeCode,
jobMaxMinutes: schedule.jobMaxMinutes
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
schedule: expect.objectContaining({
date: schedule.date,
startTime: schedule.startTime,
endTime: schedule.endTime,
routeCode: schedule.routeCode,
jobMaxMinutes: schedule.jobMaxMinutes
})
})
);
}));
});
it('calls api with expected referral date', () => {
// Arrange
var referralDate = getRandomString(6, 6);
const referralDate = getRandomString(6, 6);
store.order.referralDate = referralDate;
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
// Act
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({ referralDate: referralDate })
})
);
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({ referralDate })
}));
});
it('calls api with expected referral number', () => {
// Arrange
var referralNumber = getRandomString(6, 6);
const referralNumber = getRandomString(6, 6);
store.order.referralNumber = referralNumber;
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
// Act
store.saveSession();
// Assert
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({ referralNumber: referralNumber })
}
));
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({ referralNumber })
}));
});
});
it('No glassArray => empty list', async () => {
@ -880,15 +856,13 @@ describe('Store', () => {
await store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
damage: expect.objectContaining({
glassToReplace: []
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
damage: expect.objectContaining({
glassToReplace: []
})
})
);
}));
});
it('glassArray empty => empty list', async () => {
store.damage.glassToReplace = [];
@ -898,15 +872,13 @@ describe('Store', () => {
await store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
damage: expect.objectContaining({
glassToReplace: []
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
damage: expect.objectContaining({
glassToReplace: []
})
})
);
}));
});
it('Nonempty glass array => expected glass array sent', async () => {
const location1 = getRandomString(5);
@ -914,8 +886,8 @@ describe('Store', () => {
const name1 = getRandomString(10);
const name2 = getRandomString(10);
store.damage.glassToReplace = [
{glassLocation: location1, glassName: name1},
{glassLocation: location2, glassName: name2}
{ glassLocation: location1, glassName: name1 },
{ glassLocation: location2, glassName: name2 }
],
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
@ -923,18 +895,16 @@ describe('Store', () => {
await store.saveSession();
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
payload: expect.objectContaining({
damage: expect.objectContaining({
glassToReplace: expect.arrayContaining([
{location: location1, name: name1},
{location: location2, name: name2}
])
})
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
payload: expect.objectContaining({
damage: expect.objectContaining({
glassToReplace: expect.arrayContaining([
{ location: location1, name: name1 },
{ location: location2, name: name2 }
])
})
})
);
}));
});
it('api call throws exception', async () => {
expect.assertions(2);
@ -947,12 +917,10 @@ describe('Store', () => {
});
// Asserts
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining(
{
method: endpoints.SaveSession.method,
endpoint: endpoints.SaveSession.url
})
);
expect(globalMethods.callHttpClient).toHaveBeenCalledWith(expect.objectContaining({
method: endpoints.SaveSession.method,
endpoint: endpoints.SaveSession.url
}));
});
});
@ -1023,4 +991,17 @@ describe('Store', () => {
expect(store.applicationUser.duplicateOrders.length).toBe(0);
});
});
describe('updatePolicyITACFlag method', () => {
it('updatePolicyITACFlag updates policy.isITAC flag in store', () => {
// Assert
const moqIsITAC = getRandomBoolean();
// Act
store.updatePolicyITACFlag(moqIsITAC);
// Assert
expect(store.order.policy.isITAC).toEqual(moqIsITAC);
});
});
});