forked from RedHatInsights/frontend-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Jest test wrapper component created, CypressTestUtils folder re…
…located
- Loading branch information
1 parent
1d31fb2
commit a40800e
Showing
9 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import configureStore from 'redux-mock-store'; | ||
import { Provider } from 'react-redux'; | ||
import { MemoryRouter, Route, Routes } from 'react-router-dom'; | ||
import { IntlProvider } from 'react-intl'; | ||
|
||
const TestWrapper = ({ renderOptions = {}, children }) => { | ||
const mockStore = configureStore(); | ||
|
||
return ( | ||
<IntlProvider locale="en"> | ||
<Provider store={renderOptions?.store || mockStore()}> | ||
<MemoryRouter initialEntries={renderOptions?.initialEntries || ['/']}> | ||
{renderOptions?.componentPath ? ( | ||
<Routes> | ||
<Route path={renderOptions?.elementPath || '/'}>{children}</Route> | ||
</Routes> | ||
) : ( | ||
children | ||
)} | ||
</MemoryRouter> | ||
</Provider> | ||
</IntlProvider> | ||
); | ||
}; | ||
|
||
TestWrapper.propTypes = { | ||
children: PropTypes.element, | ||
renderOptions: PropTypes.object, | ||
}; | ||
|
||
export default TestWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './TestWrapper'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters