react-router-pagination 3.1.20 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,123 +0,0 @@
1
- import React from 'react'
2
- import renderer from 'react-test-renderer'
3
-
4
- import {
5
- MemoryRouter
6
- } from 'react-router-dom'
7
-
8
- import {
9
- toInteger,
10
- calculateTotalPages,
11
- calculatePageNumber,
12
- Standard
13
- } from '#pagination/standard/index.tsx'
14
-
15
- describe('react-router-pagination/pagination/standard', () => {
16
- describe('`toInteger`', () => {
17
- it('is a function', () => {
18
- expect(toInteger)
19
- .toEqual(expect.any(Function))
20
- })
21
- })
22
-
23
- describe('`calculateTotalPages`', () => {
24
- it('is a function', () => {
25
- expect(calculateTotalPages)
26
- .toEqual(expect.any(Function))
27
- })
28
- })
29
-
30
- describe('`calculatePageNumber`', () => {
31
- it('is a function', () => {
32
- expect(calculatePageNumber)
33
- .toEqual(expect.any(Function))
34
- })
35
- })
36
-
37
- describe('<Standard />', () => {
38
- describe('With `pageNumber` and `totalPages`', () => {
39
- it('renders', () => {
40
- const rendered = renderer.create(
41
- <MemoryRouter>
42
- <Standard
43
- pageNumber={1}
44
- totalPages={2}
45
- />
46
- </MemoryRouter>
47
- )
48
-
49
- expect(rendered.toJSON())
50
- .toMatchSnapshot()
51
- })
52
-
53
- describe('With `spread`', () => {
54
- it('renders', () => {
55
- const rendered = renderer.create(
56
- <MemoryRouter>
57
- <Standard
58
- pageNumber={5}
59
- totalPages={9}
60
- spread={3}
61
- />
62
- </MemoryRouter>
63
- )
64
-
65
- expect(rendered.toJSON())
66
- .toMatchSnapshot()
67
- })
68
- })
69
- })
70
- })
71
-
72
- describe('`Standard.calculateTotalPages()`', () => {
73
- describe('Your data contains 120 items which you want to display at 10 items per page', () => {
74
- it('returns 12', () => {
75
- expect(Standard.calculateTotalPages(120, 10)).toBe(12)
76
- })
77
- })
78
-
79
- describe('Your data contains 60 items which you want to display at 5 items per page', () => {
80
- it('returns 12', () => {
81
- expect(Standard.calculateTotalPages(60, 5)).toBe(12)
82
- })
83
- })
84
-
85
- describe('Your data contains 240 items which you want to display at 20 items per page', () => {
86
- it('returns 12', () => {
87
- expect(Standard.calculateTotalPages(240, 20)).toBe(12)
88
- })
89
- })
90
-
91
- describe('Your data contains 121 items which you want to display at 10 items per page', () => {
92
- it('returns 13', () => {
93
- expect(Standard.calculateTotalPages(121, 10)).toBe(13)
94
- })
95
- })
96
-
97
- describe('Your data contains 61 items which you want to display at 5 items per page', () => {
98
- it('returns 13', () => {
99
- expect(Standard.calculateTotalPages(61, 5)).toBe(13)
100
- })
101
- })
102
-
103
- describe('Your data contains 241 items which you want to display at 20 items per page', () => {
104
- it('returns 13', () => {
105
- expect(Standard.calculateTotalPages(241, 20)).toBe(13)
106
- })
107
- })
108
- })
109
-
110
- describe('`Standard.calculatePageNumber()`', () => {
111
- describe('Min', () => {
112
- it('returns 1', () => {
113
- expect(Standard.calculatePageNumber(0, 12)).toBe(1)
114
- })
115
- })
116
-
117
- describe('Max', () => {
118
- it('returns 12', () => {
119
- expect(Standard.calculatePageNumber(13, 12)).toBe(12)
120
- })
121
- })
122
- })
123
- })
package/tsconfig.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react",
4
- "module": "NodeNext",
5
- "target": "ESNext",
6
- "moduleResolution": "NodeNext",
7
- "noEmit": true,
8
- "strict": true,
9
- "isolatedModules": true,
10
- "noImplicitAny": true,
11
- "allowSyntheticDefaultImports": true,
12
- "allowImportingTsExtensions": true,
13
- "baseUrl": ".",
14
- "paths": {
15
- "#pagination": [
16
- "src/pagination"
17
- ],
18
- "#pagination/*": [
19
- "src/pagination/*"
20
- ]
21
- }
22
- },
23
- "include": [
24
- "src/**/*",
25
- ".storybook/**/*"
26
- ]
27
- }