Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import NextPages from "./NextPages.js";
- import Page from "../Page/Page.js";
- const exampleLinkFactory = () => (
- <a href={`#`} />
- );
- describe("Pagination/NextPages", () => {
- rendersComponent(NextPages);
- const wrapper = mount(
- <NextPages />
- );
- it("doesn\'t render a Page component", () => {
- expect(wrapper.find(Page).exists()).toEqual(false);
- });
- describe("when the current page is not the last page", () => {
- const customProps = {
- page: 2,
- totalPages: 4,
- linkFactory: exampleLinkFactory
- };
- rendersComponent(NextPages, customProps);
- const wrapper = mount(
- <NextPages { ...customProps } />
- );
- it("renders two Page components", () => {
- expect(wrapper.find(Page).length).toEqual(2);
- });
- });
- describe("when the current page is the second to last page", () => {
- const customProps = {
- page: 3,
- totalPages: 4,
- linkFactory: exampleLinkFactory
- };
- rendersComponent(NextPages, customProps);
- const wrapper = mount(
- <NextPages { ...customProps } />
- );
- it("renders two Page components", () => {
- expect(wrapper.find(Page).length).toEqual(2);
- });
- });
- describe("when the current page is the last page", () => {
- const customProps = {
- page: 4,
- totalPages: 4,
- linkFactory: exampleLinkFactory
- };
- rendersComponent(NextPages, customProps);
- const wrapper = mount(
- <NextPages { ...customProps } />
- );
- it("doesn\'t render a Page component", () => {
- expect(wrapper.find(Page).exists()).toEqual(false);
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement