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