Jest: include QueryClientProvider in tests
This commit is contained in:
parent
0eeca2be5c
commit
f6e5df2278
2 changed files with 12 additions and 9 deletions
|
@ -137,9 +137,7 @@ describe('<FeedCarousel />', () => {
|
|||
expect(screen.queryAllByTestId('prev-page')).toHaveLength(0);
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
user.click(screen.getByTestId('next-page'));
|
||||
});
|
||||
await user.click(screen.getByTestId('next-page'));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('prev-page')).toBeInTheDocument();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { configureMockStore } from '@jedmao/redux-mock-store';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import { render, RenderOptions } from '@testing-library/react';
|
||||
import { merge } from 'immutable';
|
||||
import React, { FC, ReactElement } from 'react';
|
||||
|
@ -9,6 +10,8 @@ import { Action, applyMiddleware, createStore } from 'redux';
|
|||
import thunk from 'redux-thunk';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
import { queryClient } from 'soapbox/queries/client';
|
||||
|
||||
import NotificationsContainer from '../features/ui/containers/notifications_container';
|
||||
import { default as rootReducer } from '../reducers';
|
||||
|
||||
|
@ -45,13 +48,15 @@ const TestApp: FC<any> = ({ children, storeProps, routerProps = {} }) => {
|
|||
|
||||
return (
|
||||
<Provider store={props.store}>
|
||||
<IntlProvider locale={props.locale}>
|
||||
<MemoryRouter {...routerProps}>
|
||||
{children}
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<IntlProvider locale={props.locale}>
|
||||
<MemoryRouter {...routerProps}>
|
||||
{children}
|
||||
|
||||
<NotificationsContainer />
|
||||
</MemoryRouter>
|
||||
</IntlProvider>
|
||||
<NotificationsContainer />
|
||||
</MemoryRouter>
|
||||
</IntlProvider>
|
||||
</QueryClientProvider>
|
||||
</Provider>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue