Skip to content

Commit

Permalink
test for pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-ebi committed Feb 10, 2023
1 parent e111aee commit a18974b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 0 additions & 1 deletion jest.setup.js

This file was deleted.

19 changes: 19 additions & 0 deletions src/__tests__/Pagination.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {render, screen} from "@testing-library/react";
import Pagination from "../components/Pagination";
import React from "react";
test('check genotypes table component is loading everything correctly', () => {
render(<Pagination
currentPage={1}
numPages={10}
/>)

// assert link generated for paging
expect(screen.getByRole("link", {name: 'Previous'}).textContent).toBe("Previous")
expect(screen.getByRole("link", {name: '2'}).textContent).toBe("2")
expect(screen.getByRole("link", {name: '3'}).textContent).toBe("3")
expect(screen.getByRole("link", {name: '8'}).textContent).toBe("8")
expect(screen.getByRole("link", {name: '9'}).textContent).toBe("9")
expect(screen.getByRole("link", {name: '10'}).textContent).toBe("10")
expect(screen.getByRole("link", {name: 'Next'}).textContent).toBe("Next")
expect(screen.getByText('1').textContent).toBe(""+1)
})

0 comments on commit a18974b

Please sign in to comment.