Compare commits
12 commits
7aaf0b35e7
...
21a3d58423
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21a3d58423 | ||
|
|
6053a845d9 | ||
|
|
1aa360ff72 | ||
|
|
76cdd1a1e3 | ||
|
|
a6cb1e54ac | ||
|
|
f7b753a4af | ||
|
|
f9a5bd58dd | ||
|
|
3e9aa3ee80 | ||
|
|
9231928212 | ||
|
|
434b585167 | ||
|
|
64188743ea | ||
|
|
2e4d0c48f7 |
11 changed files with 158 additions and 27 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -10740,9 +10740,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/immutable": {
|
"node_modules/immutable": {
|
||||||
"version": "4.3.8",
|
"version": "4.3.9",
|
||||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.9.tgz",
|
||||||
"integrity": "sha512-d/Ld9aLbKpNwyl0KiM2CT1WYvkitQ1TSvmRtkcV8FKStiDoA7Slzgjmb/1G2yhKM1p0XeNOieaTbFZmU1d3Xuw==",
|
"integrity": "sha512-ObHy4YN7ycwZOUCLI1/6svfyAFu7vL8RhAvVu/bh/RZW9EPlOyDaQ9jDQWCtdqzaXUjgXZCW1migtHE7YI7UGQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ const essentialClients: IClient[] = [
|
||||||
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
||||||
accountName: 'Safeco Insurance',
|
accountName: 'Safeco Insurance',
|
||||||
accountNumber: '408810',
|
accountNumber: '408810',
|
||||||
|
parentCarrierName: 'Liberty Mutual',
|
||||||
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true},
|
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true},
|
||||||
bgColor: "rgb(255, 209, 0)",
|
bgColor: "rgb(255, 209, 0)",
|
||||||
|
|
||||||
|
|
@ -223,6 +224,7 @@ const advancedClients: IClient[] = [
|
||||||
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
clientTag: 'A5F7D473-29C4-4E2C-AD08-A3AB13FE0314',
|
||||||
accountName: 'Safeco Insurance',
|
accountName: 'Safeco Insurance',
|
||||||
accountNumber: '408810',
|
accountNumber: '408810',
|
||||||
|
parentCarrierName: 'Liberty Mutual',
|
||||||
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true },
|
clientFlags: { isTpaEnabled: true, isWelcomeDamageLocationRequired: true },
|
||||||
bgColor: "rgb(255, 209, 0)",
|
bgColor: "rgb(255, 209, 0)",
|
||||||
mockProfile: {
|
mockProfile: {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ export interface IClient {
|
||||||
clientTag: string,
|
clientTag: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
accountNumber?: string,
|
accountNumber?: string,
|
||||||
|
parentCarrierName?: string,
|
||||||
clientFlags: Partial<IClientFlags>,
|
clientFlags: Partial<IClientFlags>,
|
||||||
bgColor?: string,
|
bgColor?: string,
|
||||||
mockProfile?: IClientMockProfile
|
mockProfile?: IClientMockProfile
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { buildToken, getTimestamp } from '@impl/utils/TokenUtils';
|
||||||
import ClientData from "@business-logic/data/ClientData";
|
import ClientData from "@business-logic/data/ClientData";
|
||||||
|
|
||||||
export class WelcomePage extends BasePage {
|
export class WelcomePage extends BasePage {
|
||||||
|
private static readonly GENERIC_BRAND_WORDS = new Set(['insurance', 'mutual', 'group', 'company', 'private', 'client']);
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly policyNumber: Locator;
|
readonly policyNumber: Locator;
|
||||||
readonly policyZip: Locator;
|
readonly policyZip: Locator;
|
||||||
|
|
@ -19,6 +20,8 @@ export class WelcomePage extends BasePage {
|
||||||
readonly cookieCloseButton: Locator;
|
readonly cookieCloseButton: Locator;
|
||||||
readonly GetStartedButton: Locator;
|
readonly GetStartedButton: Locator;
|
||||||
readonly applicationPageHeader: Locator;
|
readonly applicationPageHeader: Locator;
|
||||||
|
readonly applicationLogo: Locator;
|
||||||
|
readonly applicationSubHeader: Locator;
|
||||||
|
|
||||||
url = process.env['BASE_URL']! + '/?issPage=welcome-page';
|
url = process.env['BASE_URL']! + '/?issPage=welcome-page';
|
||||||
issPageValue = 'welcome-page';
|
issPageValue = 'welcome-page';
|
||||||
|
|
@ -37,6 +40,8 @@ export class WelcomePage extends BasePage {
|
||||||
this.cookieCloseButton = page.getByRole('button', { name: 'Close' });
|
this.cookieCloseButton = page.getByRole('button', { name: 'Close' });
|
||||||
this.GetStartedButton = page.getByRole('button', { name: 'Get Started' });
|
this.GetStartedButton = page.getByRole('button', { name: 'Get Started' });
|
||||||
this.applicationPageHeader = page.locator('.site-header-container');
|
this.applicationPageHeader = page.locator('.site-header-container');
|
||||||
|
this.applicationLogo = page.locator('#siteHeaderImage');
|
||||||
|
this.applicationSubHeader = page.locator('xpath=//h5[contains(@class,"subheader")]//span');
|
||||||
}
|
}
|
||||||
|
|
||||||
async goto(clientTag: string) {
|
async goto(clientTag: string) {
|
||||||
|
|
@ -91,6 +96,36 @@ export class WelcomePage extends BasePage {
|
||||||
expect(normalize(actualBgColor)).toBe(normalize(client.bgColor));
|
expect(normalize(actualBgColor)).toBe(normalize(client.bgColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private getBrandTokens(name: string): string[] {
|
||||||
|
return name
|
||||||
|
.toLowerCase()
|
||||||
|
.split(/\s+/)
|
||||||
|
.filter(word => word.length > 2 && !WelcomePage.GENERIC_BRAND_WORDS.has(word));
|
||||||
|
}
|
||||||
|
|
||||||
|
private matchesBrandText(text: string, name: string): boolean {
|
||||||
|
return this.getBrandTokens(name).some(token => text.includes(token));
|
||||||
|
}
|
||||||
|
|
||||||
|
async hasApplicationLogo(currentClientTag: string, accountNumber?: string) {
|
||||||
|
await expect(this.applicationLogo).toBeVisible();
|
||||||
|
const client = ClientData.resolveClientForTest(currentClientTag, accountNumber);
|
||||||
|
const altTextString = ((await this.applicationLogo.getAttribute('alt')) ?? '').toLowerCase();
|
||||||
|
const hasBrandMatch = this.matchesBrandText(altTextString, client?.accountName ?? '');
|
||||||
|
await expect(hasBrandMatch).toBeTruthy();
|
||||||
|
}
|
||||||
|
|
||||||
|
async hasApplicationSubHeader(currentClientTag: string, accountNumber?: string) {
|
||||||
|
await expect(this.applicationSubHeader).toBeVisible();
|
||||||
|
const client = ClientData.resolveClientForTest(currentClientTag, accountNumber);
|
||||||
|
const subHeaderTextString = ((await this.applicationSubHeader.innerText()) ?? '').toLowerCase();
|
||||||
|
|
||||||
|
await expect(subHeaderTextString).toContain('welcome to');
|
||||||
|
|
||||||
|
const brandSourceName = client?.parentCarrierName ?? client?.accountName ?? '';
|
||||||
|
const hasBrandMatch = this.matchesBrandText(subHeaderTextString, brandSourceName);
|
||||||
|
await expect(hasBrandMatch).toBeTruthy();
|
||||||
|
}
|
||||||
|
|
||||||
async validateDamageLocationFieldsIfRequired(clientTag: string, accountNumber?: string) {
|
async validateDamageLocationFieldsIfRequired(clientTag: string, accountNumber?: string) {
|
||||||
const client = ClientData.resolveClientForTest(clientTag, accountNumber);
|
const client = ClientData.resolveClientForTest(clientTag, accountNumber);
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,14 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
testCase.testData.accountNumber
|
testCase.testData.accountNumber
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await test.step('WelcomePage >> Check Application Logo', async () => {
|
||||||
|
await welcomePage.hasApplicationLogo(testCase.testData.clientTag!, testCase.testData.accountNumber);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('WelcomePage >> Check Application Sub Header - Welcome Title', async () => {
|
||||||
|
await welcomePage.hasApplicationSubHeader(testCase.testData.clientTag!, testCase.testData.accountNumber);
|
||||||
|
});
|
||||||
|
|
||||||
await test.step('WelcomePage >> Validate damage location fields', async () => {
|
await test.step('WelcomePage >> Validate damage location fields', async () => {
|
||||||
await welcomePage.validateDamageLocationFieldsIfRequired(
|
await welcomePage.validateDamageLocationFieldsIfRequired(
|
||||||
|
|
@ -764,25 +772,27 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup && !isTpaNotEnabledBailout) {
|
if (!isPolicyFound && !(isItac || isNoComp) && !isUnverifiedPolicyAfterVehicleLookup) {
|
||||||
if (isSafelite) {
|
if (isSafelite) {
|
||||||
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||||
await providerPreferencePage.selectProvider(isSafelite);
|
await providerPreferencePage.selectProvider(isSafelite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSafelite && isTpaNotEnabledBailout) {
|
if (!isSafelite && isTpaNotEnabledBailout) {
|
||||||
|
await test.step('ProviderPreferencePage >> Find another shop triggers TPA not enabled bailout', async () => {
|
||||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||||
|
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||||
|
});
|
||||||
|
|
||||||
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
||||||
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
||||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSafelite && !isTpaNotEnabledBailout) {
|
if (!isSafelite && !isTpaNotEnabledBailout) {
|
||||||
|
await providerPreferencePage.validateURL(providerPreferencePage.issPageValue);
|
||||||
await providerPreferencePage.scheduleTPAWithoutAdas();
|
await providerPreferencePage.scheduleTPAWithoutAdas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -816,15 +826,6 @@ async function runWorkflow(page: Page, testCase: TestCase) {
|
||||||
|
|
||||||
if (!isSafelite) {
|
if (!isSafelite) {
|
||||||
|
|
||||||
if (isTpaNotEnabledBailout) {
|
|
||||||
await test.step('validateBailoutDetails >> Bailout code : ' + BailoutCode.TPANotEnabled, async () => {
|
|
||||||
await bailoutPage.validateURL(bailoutPage.issPageValue);
|
|
||||||
await bailoutPage.validateBailoutDetails(customerDetails!, BailoutCode.TPANotEnabled);
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isSafelite && !isTpaNotEnabledBailout) {
|
if (!isSafelite && !isTpaNotEnabledBailout) {
|
||||||
await test.step('TpaSearchPage >> TPA Search', async () => {
|
await test.step('TpaSearchPage >> TPA Search', async () => {
|
||||||
await tpaSearchPage.validateURL(tpaSearchPage.issPageValue);
|
await tpaSearchPage.validateURL(tpaSearchPage.issPageValue);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ const essentialReplaceDynamicAdasData: Partial<ITestData> = {
|
||||||
phoneNumber: faker.helpers.fromRegExp(/[2-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/),
|
phoneNumber: faker.helpers.fromRegExp(/[2-9][0-9][0-9]-[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]/),
|
||||||
notes: 'Automated Test',
|
notes: 'Automated Test',
|
||||||
address: {
|
address: {
|
||||||
street: '9039 4th Avenue South',
|
street: '9039 4th Avenue South, seattle, washington, 98108',
|
||||||
city: 'Seattle',
|
city: 'Seattle',
|
||||||
state: 'WASHINGTON',
|
state: 'WASHINGTON',
|
||||||
postalCode: '98108',
|
postalCode: '98108',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ClientData from "@business-logic/data/ClientData";
|
import ClientData from "@business-logic/data/ClientData";
|
||||||
import TestCase from "@business-logic/types/TestCase";
|
import TestCase from "@business-logic/types/TestCase";
|
||||||
import { DamageType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
|
import { DamageType, PartQuestionType, ServiceLocation, ServicePackage, VehicleDamage, VehicleLookupType } from "@business-logic/types/Enums";
|
||||||
import { ITestData } from "@business-logic/types/ITestData"
|
import { ITestData } from "@business-logic/types/ITestData"
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
import { getNextWeekday } from "@impl/utils/DateUtils";
|
import { getNextWeekday } from "@impl/utils/DateUtils";
|
||||||
|
|
@ -14,6 +14,13 @@ const essentialTpaNotEnabledData: Partial<ITestData> = {
|
||||||
endorsements: [],
|
endorsements: [],
|
||||||
isReplace: true,
|
isReplace: true,
|
||||||
partQuestions: undefined,
|
partQuestions: undefined,
|
||||||
|
capabilityQuestions: [
|
||||||
|
{
|
||||||
|
partQuestionType: PartQuestionType.LaneKeepAssist,
|
||||||
|
isOnPage: true,
|
||||||
|
optionToSelect: 'No'
|
||||||
|
}
|
||||||
|
],
|
||||||
isSafelite: false,
|
isSafelite: false,
|
||||||
bailoutFlags: {
|
bailoutFlags: {
|
||||||
isTpaNotEnabledBailout: true
|
isTpaNotEnabledBailout: true
|
||||||
|
|
@ -44,9 +51,9 @@ const essentialTpaNotEnabledData: Partial<ITestData> = {
|
||||||
year: '2015',
|
year: '2015',
|
||||||
make: 'Ford',
|
make: 'Ford',
|
||||||
model: 'F Series F150',
|
model: 'F Series F150',
|
||||||
style: '2 door super cab',
|
style: '4 door crew cab',
|
||||||
vin: '1FTEX1C82FFB42543',
|
vin: '1FTEX1C82FFB42543',
|
||||||
licensePlateNumber: '15377DV',
|
licensePlateNumber: 'FZL3949',
|
||||||
licensePlateState: 'Texas',
|
licensePlateState: 'Texas',
|
||||||
vehicleLookupType: VehicleLookupType.LicensePlateNumber,
|
vehicleLookupType: VehicleLookupType.LicensePlateNumber,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const essentialTpaEnabledData: Partial<ITestData> = {
|
||||||
// phoneNumber: faker.phone.toString(),
|
// phoneNumber: faker.phone.toString(),
|
||||||
notes: 'Automated Test',
|
notes: 'Automated Test',
|
||||||
address: {
|
address: {
|
||||||
street: '1st St',
|
street: '1st St S, Jacksonville Beach, FL, 32250',
|
||||||
city: 'Jacksonville Beach',
|
city: 'Jacksonville Beach',
|
||||||
state: 'FLORIDA',
|
state: 'FLORIDA',
|
||||||
postalCode: '32250',
|
postalCode: '32250',
|
||||||
|
|
|
||||||
|
|
@ -362,6 +362,7 @@ export default {
|
||||||
await this.mainStore.getBillToInfo();
|
await this.mainStore.getBillToInfo();
|
||||||
|
|
||||||
// Skip duplicate check if loaded from cookie or already visited duplicate check page.
|
// Skip duplicate check if loaded from cookie or already visited duplicate check page.
|
||||||
|
// NOTE: Do not create a new referral or call policy lookup if launched from cookie (this is by design).
|
||||||
if (!this.mainStore.order.loadedFromCookie && !this.mainStore.order.visitedDuplicateCheckPage) {
|
if (!this.mainStore.order.loadedFromCookie && !this.mainStore.order.visitedDuplicateCheckPage) {
|
||||||
// getDuplicateReferrals handles exception / error internally. We do not care if it fails, user continues with creating new referral.
|
// getDuplicateReferrals handles exception / error internally. We do not care if it fails, user continues with creating new referral.
|
||||||
await this.mainStore.getDuplicateReferrals();
|
await this.mainStore.getDuplicateReferrals();
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,8 @@ export const getDefaultState = () => ({
|
||||||
coverageStatus: coverageStatuses.PENDING,
|
coverageStatus: coverageStatuses.PENDING,
|
||||||
coverageType: coverageType.NONE,
|
coverageType: coverageType.NONE,
|
||||||
isItacOptimized: false,
|
isItacOptimized: false,
|
||||||
claimNumber: null
|
claimNumber: null,
|
||||||
|
lossReportNumber: null
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
parentAccountNumber: 0,
|
parentAccountNumber: 0,
|
||||||
|
|
@ -736,13 +737,31 @@ export const useMainStore = defineStore({
|
||||||
bailoutOnError: false
|
bailoutOnError: false
|
||||||
});
|
});
|
||||||
this.order.insuranceCoverage.claimNumber = response.data.claimNumber;
|
this.order.insuranceCoverage.claimNumber = response.data.claimNumber;
|
||||||
if (response.data.isSuccess) {
|
|
||||||
this.updateCoverageStatus(coverageStatuses.VERIFIED);
|
// If register claim at end, then we have loss report number we need to populate.
|
||||||
|
if ( this.issConfig.callClaimRegistrationAtEnd ) {
|
||||||
|
if ( response.data.additionalFields?.lossReportNum ) {
|
||||||
|
this.order.insuranceCoverage.lossReportNumber = response.data.additionalFields.lossReportNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( response.data.additionalFields?.memberNum ) {
|
||||||
|
// Update member number if it is returned.
|
||||||
|
this.order.policy.memberNumber = response.data.additionalFields.memberNum;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.updateCoverageStatus(coverageStatuses.NO_COVERAGE);
|
// Only set coverage statuses if we are not calling claim registration at end of flow.
|
||||||
|
if (response.data.isSuccess) {
|
||||||
|
this.updateCoverageStatus(coverageStatuses.VERIFIED);
|
||||||
|
} else {
|
||||||
|
this.updateCoverageStatus(coverageStatuses.NO_COVERAGE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.updateCoverageStatus(coverageStatuses.NO_COVERAGE);
|
// Only set coverage statuses if we are not calling claim registration at end of flow.
|
||||||
|
if ( !this.issConfig.callClaimRegistrationAtEnd ) {
|
||||||
|
this.updateCoverageStatus(coverageStatuses.NO_COVERAGE);
|
||||||
|
}
|
||||||
|
|
||||||
this.order.insuranceCoverage.claimNumber = null;
|
this.order.insuranceCoverage.claimNumber = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1609,7 +1628,8 @@ export const useMainStore = defineStore({
|
||||||
insuranceCoverage: {
|
insuranceCoverage: {
|
||||||
coverageType: insuranceCoverage.coverageType,
|
coverageType: insuranceCoverage.coverageType,
|
||||||
coverageStatus: insuranceCoverage.coverageStatus,
|
coverageStatus: insuranceCoverage.coverageStatus,
|
||||||
claimNumber: insuranceCoverage.claimNumber
|
claimNumber: insuranceCoverage.claimNumber,
|
||||||
|
lossReportNumber: insuranceCoverage.lossReportNumber
|
||||||
},
|
},
|
||||||
payment: {
|
payment: {
|
||||||
parentAccountNumber: this.order.parentAccountNumber ?? this.issConfig.parentAccountNumber,
|
parentAccountNumber: this.order.parentAccountNumber ?? this.issConfig.parentAccountNumber,
|
||||||
|
|
@ -2039,6 +2059,7 @@ export const useMainStore = defineStore({
|
||||||
this.order.insuranceCoverage.coverageType = coverageType.NONE;
|
this.order.insuranceCoverage.coverageType = coverageType.NONE;
|
||||||
this.order.insuranceCoverage.isItacOptimized = false;
|
this.order.insuranceCoverage.isItacOptimized = false;
|
||||||
this.order.insuranceCoverage.claimNumber = null;
|
this.order.insuranceCoverage.claimNumber = null;
|
||||||
|
this.order.insuranceCoverage.lossReportNumber = null;
|
||||||
},
|
},
|
||||||
updateGlassFees(feeData) {
|
updateGlassFees(feeData) {
|
||||||
if (feeData == null) {
|
if (feeData == null) {
|
||||||
|
|
|
||||||
|
|
@ -570,6 +570,69 @@ describe('Store', () => {
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('updates lossReportNumber and memberNumber when claim registration runs at end of flow', async () => {
|
||||||
|
// Arrange
|
||||||
|
const returnedLossReportNumber = getRandomString(8, 8);
|
||||||
|
const returnedMemberNumber = getRandomString(8, 8);
|
||||||
|
store.issConfig.callClaimRegistrationAtEnd = true;
|
||||||
|
store.order.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
store.order.policy.memberNumber = null;
|
||||||
|
|
||||||
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({
|
||||||
|
data: {
|
||||||
|
claimNumber: 'CLM123',
|
||||||
|
isSuccess: false,
|
||||||
|
additionalFields: {
|
||||||
|
lossReportNum: returnedLossReportNumber,
|
||||||
|
memberNum: returnedMemberNumber
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await store.registerClaim();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.order.insuranceCoverage.claimNumber).toBe('CLM123');
|
||||||
|
expect(store.order.insuranceCoverage.lossReportNumber).toBe(returnedLossReportNumber);
|
||||||
|
expect(store.order.policy.memberNumber).toBe(returnedMemberNumber);
|
||||||
|
expect(store.order.insuranceCoverage.coverageStatus).toBe(coverageStatuses.PENDING);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not update coverage status on failed response when claim registration runs at end of flow', async () => {
|
||||||
|
// Arrange
|
||||||
|
store.issConfig.callClaimRegistrationAtEnd = true;
|
||||||
|
store.order.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
|
||||||
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({
|
||||||
|
data: {
|
||||||
|
claimNumber: null,
|
||||||
|
isSuccess: false,
|
||||||
|
additionalFields: {}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await store.registerClaim();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.order.insuranceCoverage.coverageStatus).toBe(coverageStatuses.PENDING);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not update coverage status in catch when claim registration runs at end of flow', async () => {
|
||||||
|
// Arrange
|
||||||
|
store.issConfig.callClaimRegistrationAtEnd = true;
|
||||||
|
store.order.insuranceCoverage.coverageStatus = coverageStatuses.PENDING;
|
||||||
|
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.reject(new Error('register claim error')));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await store.registerClaim();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.order.insuranceCoverage.coverageStatus).toBe(coverageStatuses.PENDING);
|
||||||
|
expect(store.order.insuranceCoverage.claimNumber).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('updateContactInfo method', () => {
|
describe('updateContactInfo method', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue