refactor unit test
This commit is contained in:
parent
8b1c6c6417
commit
c7d7cbdf15
2 changed files with 10 additions and 6 deletions
|
|
@ -29,6 +29,10 @@ const footerStub = {
|
|||
}
|
||||
};
|
||||
|
||||
const headerStub = {
|
||||
render: () => {}
|
||||
};
|
||||
|
||||
function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRun = () => {}) {
|
||||
const mountOptions = getMountOptions({
|
||||
router: {
|
||||
|
|
@ -38,8 +42,10 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu
|
|||
});
|
||||
|
||||
mountOptions.global.stubs = {
|
||||
siteFooter: footerStub
|
||||
siteFooter: footerStub,
|
||||
siteHeader: headerStub
|
||||
};
|
||||
|
||||
const testingPinia = createTestingPinia({
|
||||
initialState: {
|
||||
main: mainInitialState
|
||||
|
|
@ -72,7 +78,7 @@ describe('OrderConfirmation.vue', () => {
|
|||
const { wrapper } = getMountedComponent({});
|
||||
|
||||
// Act
|
||||
const siteHeader = wrapper.findComponent({ ref: 'siteHeader' });
|
||||
const siteHeader = wrapper.findComponent(headerStub);
|
||||
|
||||
// Assert
|
||||
expect(siteHeader.exists()).toBe(true);
|
||||
|
|
@ -121,5 +127,5 @@ describe('OrderConfirmation.vue', () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigateToExternalUrl).toHaveBeenCalledWith(carrierReturnUrl);
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
@invalidSubmit="onInvalidSubmit">
|
||||
<div class="page-container-grouped-styles">
|
||||
<div class="fade-on-route-transition position-relative">
|
||||
<siteHeader
|
||||
ref="siteHeader"
|
||||
cmsWidgetName="SiteHeaderWidget" />
|
||||
<siteHeader cmsWidgetName="SiteHeaderWidget" />
|
||||
<div class="container-fluid pb-2">
|
||||
<p>Placeholder for order confirmation page</p>
|
||||
<siteFooter
|
||||
|
|
|
|||
Loading…
Reference in a new issue