parent
90b2218b5a
commit
69cf478959
@ -1,10 +1,31 @@
|
||||
import {render} from '@testing-library/react';
|
||||
import configureStore from "redux-mock-store";
|
||||
|
||||
import BlogSearch from './blog-search';
|
||||
import {Provider} from "react-redux";
|
||||
|
||||
jest.mock("next/router", () => ({
|
||||
useRouter() {
|
||||
return {
|
||||
route: "/",
|
||||
pathname: "",
|
||||
query: "",
|
||||
asPath: "",
|
||||
};
|
||||
},
|
||||
}));
|
||||
|
||||
describe('BlogSearch', () => {
|
||||
const initialState = {results: []};
|
||||
const mockStore = configureStore();
|
||||
let store;
|
||||
|
||||
it('should render successfully', () => {
|
||||
const { baseElement } = render(<BlogSearch />);
|
||||
store = mockStore(initialState);
|
||||
const {baseElement} = render(
|
||||
<Provider store={store}>
|
||||
<BlogSearch />
|
||||
</Provider>);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in new issue