diff --git a/src/constants/dynamic-strings.js b/src/constants/dynamic-strings.js index ffea41fc..52034987 100644 --- a/src/constants/dynamic-strings.js +++ b/src/constants/dynamic-strings.js @@ -4,7 +4,8 @@ const dynamicStrings = Object.freeze({ ROUTER_LINK: 'routerLink:', MODAL_LINK: 'modalLink', TEXT_LINK: 'textLink', - EXTERNAL_LINK: 'externalLink' + EXTERNAL_LINK: 'externalLink', + PHONE_LINK: 'phoneLink' }); export default dynamicStrings; diff --git a/src/helpers/cms-content-helper.js b/src/helpers/cms-content-helper.js index 4b44e722..b5dd2e97 100644 --- a/src/helpers/cms-content-helper.js +++ b/src/helpers/cms-content-helper.js @@ -623,6 +623,15 @@ export function getRouterLinkHtmlStringFromCopy(copy) { return `${getRouterLinkDisplayTextFromCopy(copy)}`; } +/** + * Returns a phone link as an 'a' tag element + * @param copy + * @returns string + */ +export function getPhoneLinkHtmlStringFromPhoneNumber(phoneNumber) { + return `${phoneNumber}.`; +} + // Copy returned from the CMS that has newlines will return blocks wrapped in //
...
// This function returns an array of each paragraph, works with or without html diff --git a/src/helpers/order-helper.js b/src/helpers/order-helper.js index 3190e7f7..f1ab7c72 100644 --- a/src/helpers/order-helper.js +++ b/src/helpers/order-helper.js @@ -40,12 +40,12 @@ export async function submitWorkOrder({ submitType }) { shouldAwaitSaveSessionQueue: true, submitAfterSave: true }); - store.createSubmittedOrder(submitType); + await store.createSubmittedOrder(submitType); } export async function submitBailout() { const store = useMainStore(); store.resetSubmittedOrder(); await store.saveSession({}); - store.createSubmittedOrder(submitType.BAILOUT); + await store.createSubmittedOrder(submitType.BAILOUT); } diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.spec.js b/src/layouts/tpa-confirmation/tpa-confirmation.spec.js index cfd64cba..9e349cf2 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.spec.js +++ b/src/layouts/tpa-confirmation/tpa-confirmation.spec.js @@ -2,14 +2,12 @@ import tpaConfirmation from '@/layouts/tpa-confirmation/tpa-confirmation.vue'; // Supporting Files -import { getEnumName, getMountOptions } from '@/helpers/unit-test-helper.js'; +import { getMountOptions } from '@/helpers/unit-test-helper.js'; import { getDefaultState, useMainStore } from '@/store/index.js'; import settleAllPromises from '@/helpers/layout-helper.js'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import { mount } from '@vue/test-utils'; import { createTestingPinia } from '@pinia/testing'; -import coverageStatuses from '@/constants/coverage-statuses'; -import { deepClone } from '@/helpers/object-helper'; jest.mock('@/helpers/layout-helper.js', () => jest.fn()); @@ -20,6 +18,7 @@ jest.mock('@/helpers/cms-content-helper', () => ({ splitCopyOnCMSPlaceHolder: jest.fn().mockImplementation(() => 'test'), getRouterLinkRouteFromCopy: jest.fn(), getRouterLinkDisplayTextFromCopy: jest.fn(), + getPhoneLinkHtmlStringFromPhoneNumber: jest.fn(), doesCopyContainTextLink: jest.fn() })); @@ -122,27 +121,6 @@ describe('TPAConfirmation.vue', () => { // Assert expect(bodyTwo.exists()).toBe(true); }); - test('Should render Order Details title', () => { - // Act - const orderDetailsTitle = wrapper.findComponent({ ref: 'tpaConfirmationOrderDetailsTitle' }); - - // Assert - expect(orderDetailsTitle.exists()).toBe(true); - }); - test('Should render Order Details body', () => { - // Act - const orderDetailsBody = wrapper.findComponent({ ref: 'tpaConfirmationOrderDetailsBody' }); - - // Assert - expect(orderDetailsBody.exists()).toBe(true); - }); - test('Should render Deductible Box', () => { - // Act - const deductibleBox = wrapper.findComponent({ ref: 'deductibleBox' }); - - // Assert - expect(deductibleBox.exists()).toBe(true); - }); test('If Advanced flow, should display Site Footer', () => { // Arrange const carrierReturnUrl = 'testURL'; @@ -167,127 +145,7 @@ describe('TPAConfirmation.vue', () => { expect(siteFooter.isVisible()).toBe(false); }); }); - describe('Computed properties', () => { - describe('Deductible Box value', () => { - test('Should return "Verifying coverage" when isVerified false', () => { - // Arrange - const initialStore = { - order: { - insuranceCoverage: { - coverageStatus: coverageStatuses.PENDING - } - } - }; - const mockStoreActions = () => { - useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => defaultOrder); - }; - const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions); - const expected = 'Verifying coverage'; - - // Assert - expect(wrapper.vm.deductibleBoxValue).toBe(expected); - }); - test('Should return deductible value when isVerified true', () => { - // Arrange - const currentDeductible = '500'; - const initialStore = { - order: { - insuranceCoverage: { - coverageStatus: coverageStatuses.VERIFIED - }, - currentDeductible - } - }; - const order = deepClone(defaultOrder); - order.isVerified = true; - const mockStoreActions = () => { - useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order); - }; - const { wrapper } = getMountedComponent(initialStore, {}, mockStoreActions); - const notExpected = 'Verifying coverage'; - - // Assert - expect(wrapper.vm.deductibleBoxValue).not.toBe(notExpected); - }); - }); - }); describe('Methods', () => { - describe.only('getCustomValueFromString', () => { - describe.each([ - [false, false, 0], - [false, false, 500], - [false, true, 0], - [true, true, 500] - ])('with argument deductibleAboveZero', (expected, isVerified, deductible) => { - test(`returns ${expected} when coverageStatus is ${getEnumName(coverageStatuses, status)} and currentDeductible is ${deductible}`, () => { - // Arrange - const order = deepClone(defaultOrder); - order.isVerified = isVerified; - order.currentDeductible = deductible; - const mockStoreActions = () => { - useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order); - }; - const { wrapper } = getMountedComponent({}, {}, mockStoreActions); - const argument = 'deductibleAboveZero'; - - // Act - const result = wrapper.vm.getCustomValueFromString(argument); - - // Assert - expect(result).toBe(expected); - }); - }); - describe('with argument zeroDeductible', () => { - describe.each([ - [false, false, 0], - [false, false, 500], - [true, true, 0], - [false, true, 500] - ])('with argument zeroDeductible', (expected, isVerified, deductible) => { - test(`returns ${expected} when coverageStatus is ${getEnumName(coverageStatuses, status)} and currentDeductible is ${deductible}`, () => { - // Arrange - const order = deepClone(defaultOrder); - order.isVerified = isVerified; - order.currentDeductible = deductible; - const mockStoreActions = () => { - useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order); - }; - const { wrapper } = getMountedComponent({}, {}, mockStoreActions); - const argument = 'zeroDeductible'; - - // Act - const result = wrapper.vm.getCustomValueFromString(argument); - - // Assert - expect(result).toBe(expected); - }); - }); - }); - describe('with argument verifyingCoverage', () => { - describe.each([ - [true, false], - [false, true] - ])('with argument zeroDeductible', (expected, isVerified) => { - test(`returns ${expected} when coverageStatus is ${getEnumName(coverageStatuses, status)}`, () => { - // Arrange - const order = deepClone(defaultOrder); - order.isVerified = isVerified; - order.currentDeductible = 123; - const mockStoreActions = () => { - useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => order); - }; - const { wrapper } = getMountedComponent({}, {}, mockStoreActions); - const argument = 'verifyingCoverage'; - - // Act - const result = wrapper.vm.getCustomValueFromString(argument); - - // Assert - expect(result).toBe(expected); - }); - }); - }); - }); describe('Navigation', () => { const mockStoreActions = () => { useMainStore().getSubmittedOrder = jest.fn().mockImplementation(() => defaultOrder); diff --git a/src/layouts/tpa-confirmation/tpa-confirmation.vue b/src/layouts/tpa-confirmation/tpa-confirmation.vue index 08d520ff..5dd49a1d 100644 --- a/src/layouts/tpa-confirmation/tpa-confirmation.vue +++ b/src/layouts/tpa-confirmation/tpa-confirmation.vue @@ -12,40 +12,21 @@