Remove unneeded tests, fix others
This commit is contained in:
parent
9d0a15f861
commit
8c167c4edf
3 changed files with 3 additions and 159 deletions
|
|
@ -39,7 +39,7 @@ import {
|
|||
splitCopyOnCMSPlaceHolder,
|
||||
getRouterLinkRouteFromCopy,
|
||||
getRouterLinkDisplayTextFromCopy,
|
||||
getExternalLink,
|
||||
getExternalLink
|
||||
} from '@/helpers/cms-content-helper';
|
||||
import applicationConfig from '@/constants/application-config';
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -123,20 +123,6 @@ export default {
|
|||
)
|
||||
?.replaceAll('{custom:carrierName}', this.carrierName);
|
||||
},
|
||||
orderDetailsTitle() {
|
||||
return this.getCmsContent('OrderDetailsContent', 'HeaderText');
|
||||
},
|
||||
orderDetailsBody() {
|
||||
const orderDetailsBodyText = this.getCmsContent(
|
||||
'OrderDetailsContent',
|
||||
'BodyText'
|
||||
);
|
||||
return this.processIfStatements(
|
||||
orderDetailsBodyText,
|
||||
'custom',
|
||||
this.getCustomValueFromString
|
||||
);
|
||||
},
|
||||
deductibleBoxValue() {
|
||||
return this.isVerified
|
||||
? this.formatAmountInDollars(this.currentDeductible)
|
||||
|
|
|
|||
Loading…
Reference in a new issue