1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Adjust renderWithProvider to accommodate redux-less components (#10857)

This commit is contained in:
Thomas Huang 2021-04-09 08:59:32 -07:00 committed by GitHub
parent 8df7a712f3
commit f7f1f28752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,11 +43,16 @@ export function mountWithRouter(component, store = {}, pathname = '/') {
}
export function renderWithProvider(component, store) {
const Wrapper = () => (
<Provider store={store}>
const Wrapper = () =>
store ? (
<Provider store={store}>
<MemoryRouter initialEntries={['/']} initialIndex={0}>
<LegacyI18nProvider>{component}</LegacyI18nProvider>
</MemoryRouter>
</Provider>
) : (
<LegacyI18nProvider>{component}</LegacyI18nProvider>
</Provider>
);
);
return render(<Wrapper />);
}