-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
44 lines (31 loc) · 1.07 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var PaginationHelper = require('./index');
var helper = new PaginationHelper(['a', 'b', 'c', 'd', 'e', 'f'], 4);
describe("PaginatororHelper", function () {
test("pageCount() should == 2", function () {
expect(helper.pageCount()).toBe(2);
});
test("itemCount() should == 6", function () {
expect(helper.itemCount()).toBe(6);
});
test("pageItemCount(0) should == 4", function () {
expect(helper.pageItemCount(0)).toBe(4);
});
test("pageItemCount(1) last page - should == 2", function () {
expect(helper.pageItemCount(1)).toBe(2);
});
test("pageItemCount(2) should == -1 since the page is invalid", function () {
expect(helper.pageItemCount(2)).toBe(-1);
});
test("pageIndex(5) should == 1 (zero based index)", function () {
expect(helper.pageIndex(5)).toBe(1);
});
test("pageIndex(2) should == 0", function () {
expect(helper.pageIndex(2)).toBe(0);
});
test("pageIndex(20) should == -1", function () {
expect(helper.pageIndex(20)).toBe(-1);
});
test("pageIndex(-10) should == -1", function () {
expect(helper.pageIndex(-10)).toBe(-1);
});
});