Fixing styling

This commit is contained in:
brydon1 2023-07-28 16:29:42 -04:00
parent 1777bf08e4
commit a3de3f7ca4

View file

@ -12,40 +12,95 @@ import { settleAllPromises } from '@/helpers/layout-helper.js';
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
// Mock our module for promises // Mock our module for promises
jest.mock("@/helpers/layout-helper.js", () => ({ jest.mock('@/helpers/layout-helper.js', () => ({
settleAllPromises: jest.fn(), settleAllPromises: jest.fn(),
})); }));
// Mock fetchCmsContentForPage, setupModalLinks, and processIfStatements // Mock fetchCmsContentForPage, setupModalLinks, and processIfStatements
jest.mock("@/helpers/cms-content-helper", () => ({ jest.mock('@/helpers/cms-content-helper', () => ({
fetchCmsContentForPage: jest.fn(), fetchCmsContentForPage: jest.fn(),
setupModalLinks: jest.fn(), setupModalLinks: jest.fn(),
processIfStatements: jest.fn() processIfStatements: jest.fn()
})); }));
const mockMixin = {
methods: {
getCmsContent: jest.fn().mockImplementation(() => ''),
setCmsContent: jest.fn()
}
};
const footerStub = {
render: () => {},
methods: {
updateButtonText: jest.fn()
}
};
const loadingModalStub = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
};
function setupMocks() {
const mountOptions = getMountOptions({
router: {
navigate: jest.fn()
}
});
mountOptions.global = {
stubs: {
siteFooter: footerStub,
siteHeader: true,
recalModal: true,
contentGroupModal: true,
alert: true,
loadingModal: loadingModalStub
}
};
mountOptions.mixins = [mockMixin];
const apiResponses = {
supportingItems: []
};
const apiPromise = Promise.resolve(apiResponses);
settleAllPromises.mockImplementation(() => apiPromise);
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
const wrapper = mount(coverageStatement, mountOptions);
wrapper.vm.$refs.siteFooter.updateButtonText = jest.fn();
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
return { wrapper };
}
describe('coverageStatement.vue', () => { describe('coverageStatement.vue', () => {
describe("method arePagePrerequisitesValid...", () => { describe('method arePagePrerequisitesValid...', () => {
test("Should return true for valid page requisites if vin exists", () => { test('Should return true for valid page requisites if vin exists', () => {
// Arrange // Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
useMainStore().order.vehicle.vin = getRandomString(5,20); useMainStore().order.vehicle.vin = getRandomString(5,20);
// Act // Act
let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
//Assert // Assert
expect(arePagePrerequisitesValid).toBe(true); expect(arePagePrerequisitesValid).toBe(true);
}); });
test("Should return false for valid page requisites if vin is missing", () => { test('Should return false for valid page requisites if vin is missing', () => {
// Arrange // Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
useMainStore().order.vehicle.vin = null; useMainStore().order.vehicle.vin = null;
// Act // Act
let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid(); const arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
//Assert // Assert
expect(arePagePrerequisitesValid).toBe(false); expect(arePagePrerequisitesValid).toBe(false);
}); });
}); });
@ -59,7 +114,7 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(siteHeader.exists()).toBe(true); expect(siteHeader.exists()).toBe(true);
}), });
test('Should render site subheader', () => { test('Should render site subheader', () => {
// Arrange // Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
@ -70,6 +125,7 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(subheader.exists()).toBe(true); expect(subheader.exists()).toBe(true);
}); });
test('Should render explanatory text', () => { test('Should render explanatory text', () => {
// Arrange // Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
@ -102,20 +158,12 @@ describe('coverageStatement.vue', () => {
}); });
}); });
describe('Verified ITAC scenario', () => { describe('Verified ITAC scenario', () => {
const loadingModal = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
const sellingPrice = getRandomInt(100, 500);
test('If policy lookup successful, not No Comp, and deductible > service price, verifiedITAC returns true', () => { test('If policy lookup successful, not No Comp, and deductible > service price, verifiedITAC returns true', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
mixins: [mockMixin] mixins: [mockMixin]
}; };
const sellingPrice = getRandomInt(100, 500);
const deductible = sellingPrice + 1; const deductible = sellingPrice + 1;
const mainInitialState = { const mainInitialState = {
order: { order: {
@ -125,7 +173,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
}, },
policyLookupSuccessful: true policyLookupSuccessful: true
} }
@ -138,26 +186,26 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
] ]
}) });
// Assert // Assert
expect(wrapper.vm.verifiedITAC).toBeTruthy(); expect(wrapper.vm.verifiedITAC).toBeTruthy();
@ -185,14 +233,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -211,7 +259,7 @@ describe('coverageStatement.vue', () => {
isRepair: true isRepair: true
}, },
policy: { policy: {
noCoverage: true, noCoverage: true
} }
} }
}; };
@ -222,14 +270,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -242,6 +290,7 @@ describe('coverageStatement.vue', () => {
const mountOptions = { const mountOptions = {
mixins: [mockMixin] mixins: [mockMixin]
}; };
const sellingPrice = getRandomInt(100, 500);
const deductible = sellingPrice - 1; const deductible = sellingPrice - 1;
const mainInitialState = { const mainInitialState = {
order: { order: {
@ -251,7 +300,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
} }
} }
} }
@ -263,40 +312,32 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
] ]
}) });
// Assert // Assert
expect(wrapper.vm.verifiedITAC).toBeFalsy(); expect(wrapper.vm.verifiedITAC).toBeFalsy();
}); });
}); });
describe('Verified Deductible scenario', () => { describe('Verified Deductible scenario', () => {
const loadingModal = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
test('If policy lookup successful, not No Comp, and service price > deductible, verifiedITAC returns true', () => { test('If policy lookup successful, not No Comp, and service price > deductible, verifiedITAC returns true', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
@ -312,7 +353,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
}, },
policyLookupSuccessful: true policyLookupSuccessful: true
} }
@ -325,26 +366,26 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
] ]
}) });
// Assert // Assert
expect(wrapper.vm.verifiedDeductible).toBeTruthy(); expect(wrapper.vm.verifiedDeductible).toBeTruthy();
@ -371,14 +412,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -398,7 +439,7 @@ describe('coverageStatement.vue', () => {
isRepair: true isRepair: true
}, },
policy: { policy: {
noCoverage: true, noCoverage: true
} }
} }
}; };
@ -409,14 +450,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -439,7 +480,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
} }
} }
} }
@ -451,40 +492,32 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
] ]
}) });
// Assert // Assert
expect(wrapper.vm.verifiedDeductible).toBeFalsy(); expect(wrapper.vm.verifiedDeductible).toBeFalsy();
}); });
}); });
describe('No Comp scenario', () => { describe('No Comp scenario', () => {
const loadingModal = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
test('If noCoverage = true, verifiedNoComp returns true', () => { test('If noCoverage = true, verifiedNoComp returns true', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
@ -508,14 +541,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -534,7 +567,7 @@ describe('coverageStatement.vue', () => {
isRepair: true isRepair: true
}, },
policy: { policy: {
noCoverage: false, noCoverage: false
} }
} }
}; };
@ -545,14 +578,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -562,14 +595,6 @@ describe('coverageStatement.vue', () => {
}); });
}); });
describe('Unverified scenario', () => { describe('Unverified scenario', () => {
const loadingModal = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
test('If policyLookupSuccessful false, unverified returns true', () => { test('If policyLookupSuccessful false, unverified returns true', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
@ -592,14 +617,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -629,14 +654,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -646,21 +671,6 @@ describe('coverageStatement.vue', () => {
}); });
}); });
describe('Navigation', () => { describe('Navigation', () => {
const footer = {
render: () => {},
methods: {
updateButtonText: jest.fn()
}
}
const loadingModal = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
const sellingPrice = getRandomInt(100, 500);
test('If Unverified, navigate forward with CLICKED_FORWARD scenario', () => { test('If Unverified, navigate forward with CLICKED_FORWARD scenario', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
@ -686,19 +696,19 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, },
mocks: { mocks: {
$router: { $router: {
navigate: jest.fn() navigate: jest.fn()
} }
} }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -719,6 +729,7 @@ describe('coverageStatement.vue', () => {
mixins: [mockMixin] mixins: [mockMixin]
}; };
const sellingPrice = getRandomInt(100, 500);
const deductible = sellingPrice - 1; const deductible = sellingPrice - 1;
const mainInitialState = { const mainInitialState = {
order: { order: {
@ -728,7 +739,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
}, },
policyLookupSuccessful: true policyLookupSuccessful: true
} }
@ -741,27 +752,27 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, },
mocks: { mocks: {
$router: { $router: {
navigate: jest.fn() navigate: jest.fn()
} }
} }
} };
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
] ]
}); });
@ -781,6 +792,7 @@ describe('coverageStatement.vue', () => {
}, },
mixins: [mockMixin] mixins: [mockMixin]
}; };
const sellingPrice = getRandomInt(100, 500);
const deductible = sellingPrice + 1; const deductible = sellingPrice + 1;
const mainInitialState = { const mainInitialState = {
order: { order: {
@ -790,12 +802,11 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
}, },
policyLookupSuccessful: true policyLookupSuccessful: true
} }
}, }
}; };
mountOptions.global = { mountOptions.global = {
plugins: [createTestingPinia({ plugins: [createTestingPinia({
@ -804,12 +815,12 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, },
mocks: { mocks: {
$router: { $router: {
@ -822,9 +833,9 @@ describe('coverageStatement.vue', () => {
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
], ],
selectedProvider: 'Safelite' selectedProvider: 'Safelite'
@ -835,9 +846,9 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(wrapper.vm.$router.navigate) expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, undefined); .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, undefined);
}); });
test('If Verified ITAC, selected other shop, and TPA enabled, navigate forward with CLICKED_FORWARD_WITH_TPA_ENABLED scenario', () => { test('If Verified ITAC, selected other shop, and TPA enabled, navigate forward w/ CLICKED_FORWARD_WITH_TPA_ENABLED', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
router: { router: {
@ -845,7 +856,7 @@ describe('coverageStatement.vue', () => {
}, },
mixins: [mockMixin] mixins: [mockMixin]
}; };
const sellingPrice = getRandomInt(100, 500);
const deductible = sellingPrice + 1; const deductible = sellingPrice + 1;
const mainInitialState = { const mainInitialState = {
order: { order: {
@ -855,7 +866,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
}, },
policyLookupSuccessful: true policyLookupSuccessful: true
} }
@ -871,12 +882,12 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, },
mocks: { mocks: {
$router: { $router: {
@ -889,9 +900,9 @@ describe('coverageStatement.vue', () => {
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
], ],
selectedProvider: 'Other' selectedProvider: 'Other'
@ -904,7 +915,7 @@ describe('coverageStatement.vue', () => {
expect(wrapper.vm.$router.navigate) expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED, undefined); .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED, undefined);
}); });
test('If Verified ITAC, selected other shop, and TPA disabled, navigate forward with CLICKED_FORWARD_WITH_TPA_DISABLED scenario', () => { test('If Verified ITAC, selected other shop, and TPA disabled, navigate forward w/ CLICKED_FORWARD_WITH_TPA_DISABLED', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
router: { router: {
@ -912,7 +923,7 @@ describe('coverageStatement.vue', () => {
}, },
mixins: [mockMixin] mixins: [mockMixin]
}; };
const sellingPrice = getRandomInt(100, 500);
const deductible = sellingPrice + 1; const deductible = sellingPrice + 1;
const mainInitialState = { const mainInitialState = {
order: { order: {
@ -922,7 +933,7 @@ describe('coverageStatement.vue', () => {
policy: { policy: {
noCoverage: false, noCoverage: false,
deductible: { deductible: {
repair: deductible, repair: deductible
}, },
policyLookupSuccessful: true policyLookupSuccessful: true
} }
@ -938,27 +949,27 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, },
mocks: { mocks: {
$router: { $router: {
navigate: jest.fn() navigate: jest.fn()
} }
} }
} };
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
], ],
selectedProvider: 'Other' selectedProvider: 'Other'
@ -968,7 +979,6 @@ describe('coverageStatement.vue', () => {
wrapper.vm.forwardButtonAction(); wrapper.vm.forwardButtonAction();
// Assert // Assert
//expect(wrapper.vm.verifiedITAC).toBeTruthy();
expect(wrapper.vm.$router.navigate) expect(wrapper.vm.$router.navigate)
.toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED, undefined); .toHaveBeenCalledWith(navigationScenarios.CLICKED_FORWARD_WITH_TPA_DISABLED, undefined);
}); });
@ -999,19 +1009,19 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, },
mocks: { mocks: {
$router: { $router: {
navigate: jest.fn() navigate: jest.fn()
} }
} }
} };
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
wrapper.setData({ wrapper.setData({
@ -1028,14 +1038,7 @@ describe('coverageStatement.vue', () => {
}); });
}); });
describe('ADAS', () => { describe('ADAS', () => {
const loadingModal = { test('if Replace and parts require recalibration, isADAS should return true', () => {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
test("if Replace and parts require recalibration, isADAS should return true", () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
mixins: [mockMixin] mixins: [mockMixin]
@ -1063,14 +1066,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -1078,7 +1081,7 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(wrapper.vm.isADAS).toBeTruthy(); expect(wrapper.vm.isADAS).toBeTruthy();
}); });
test("if Replace and parts do not require recalibration, isADAS should return false", () => { test('if Replace and parts do not require recalibration, isADAS should return false', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
mixins: [mockMixin] mixins: [mockMixin]
@ -1106,14 +1109,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -1121,7 +1124,7 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(wrapper.vm.isADAS).toBeFalsy(); expect(wrapper.vm.isADAS).toBeFalsy();
}); });
test("if Repair, isADAS should return true", () => { test('if Repair, isADAS should return true', () => {
// Arrange // Arrange
const mountOptions = { const mountOptions = {
mixins: [mockMixin] mixins: [mockMixin]
@ -1131,7 +1134,7 @@ describe('coverageStatement.vue', () => {
order: { order: {
damage: { damage: {
isRepair: true isRepair: true
}, }
} }
}; };
@ -1142,14 +1145,14 @@ describe('coverageStatement.vue', () => {
} }
})], })],
stubs: { stubs: {
'siteFooter': footer, siteFooter: footerStub,
siteHeader: true, siteHeader: true,
recalModal: true, recalModal: true,
contentGroupModal: true, contentGroupModal: true,
alert: true, alert: true,
'loadingModal': loadingModal loadingModal: loadingModalStub
}, }
} };
// Act // Act
const wrapper = mount(coverageStatement, mountOptions); const wrapper = mount(coverageStatement, mountOptions);
@ -1157,9 +1160,9 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(wrapper.vm.isADAS).toBeFalsy(); expect(wrapper.vm.isADAS).toBeFalsy();
}); });
}) });
describe("claim registration api call", () => { describe.only('claim registration api call', () => {
it("claim registration not required => method not called", async () => { it('claim registration not required => method not called', async () => {
// Arrange // Arrange
const wrapper = setupMocks({}); const wrapper = setupMocks({});
@ -1178,9 +1181,9 @@ describe('coverageStatement.vue', () => {
expect(store.registerClaim).not.toHaveBeenCalled(); expect(store.registerClaim).not.toHaveBeenCalled();
}); });
it("claim registration required => register claim method called", async () => { it.only('claim registration required => register claim method called', async () => {
// Arrange // Arrange
const sellingPrice = getRandomInt(50,100); const sellingPrice = getRandomInt(50, 100);
const deductible = sellingPrice - 1; const deductible = sellingPrice - 1;
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
}); });
@ -1188,12 +1191,12 @@ describe('coverageStatement.vue', () => {
await wrapper.setData({ await wrapper.setData({
availableLineItems: [ availableLineItems: [
{ {
sellingPrice: sellingPrice, sellingPrice,
kitPrice: 0, kitPrice: 0,
laborAmount: 0, laborAmount: 0
} }
] ]
}) });
const store = useMainStore(); const store = useMainStore();
store.order.policy.policyLookupSuccessful = true; store.order.policy.policyLookupSuccessful = true;
@ -1203,7 +1206,7 @@ describe('coverageStatement.vue', () => {
store.order.policy.deductible.repair = deductible; store.order.policy.deductible.repair = deductible;
const to = { const to = {
query: { issPage: getRandomString(4,10) } query: { issPage: getRandomString(4, 10) }
}; };
const next = jest.fn(); const next = jest.fn();
@ -1212,61 +1215,5 @@ describe('coverageStatement.vue', () => {
// Assert // Assert
expect(store.registerClaim).toHaveBeenCalled(); expect(store.registerClaim).toHaveBeenCalled();
}); });
})
})
const mockMixin = {
methods: {
getCmsContent: jest.fn().mockImplementation(() => ''),
setCmsContent: jest.fn(),
},
};
const footer = {
render: () => {},
methods: {
updateButtonText: jest.fn()
}
}
const loadingModal = {
render: () => {},
methods: {
showModal: jest.fn(),
hideModal: jest.fn()
}
}
function setupMocks()
{
const mountOptions = getMountOptions({
router: {
navigate: jest.fn()
},
}); });
});
mountOptions.global = {
stubs: {
'siteFooter': footer,
siteHeader: true,
recalModal: true,
contentGroupModal: true,
alert: true,
'loadingModal': loadingModal
},
}
mountOptions.mixins = [mockMixin];
const apiResponses = {
supportingItems: [],
};
const apiPromise = Promise.resolve(apiResponses);
settleAllPromises.mockImplementation(() => apiPromise);
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
const wrapper = mount(coverageStatement, mountOptions);
wrapper.vm.$refs.siteFooter.updateButtonText = jest.fn();
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
return { wrapper };
}