Skip to content

Commit 3f7e0aa

Browse files
committed
Add to utils tests
1 parent 1ebab32 commit 3f7e0aa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

site/src/components/PaginationWidget/utils.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { buildPagedList } from "./utils"
1+
import { buildPagedList, getOffset } from "./utils"
22

33
describe("unit/PaginationWidget", () => {
44
describe("buildPagedList", () => {
@@ -27,3 +27,16 @@ describe("unit/PaginationWidget", () => {
2727
)
2828
})
2929
})
30+
31+
describe("getOffset", () => {
32+
it("returns 0 on page 1", () => {
33+
const page = 1
34+
const limit = 10
35+
expect(getOffset(page, limit)).toEqual(0)
36+
})
37+
it("returns the limit on page 2", () => {
38+
const page = 2
39+
const limit = 10
40+
expect(getOffset(page, limit)).toEqual(limit)
41+
})
42+
})

0 commit comments

Comments
 (0)