Skip to content

Commit b9d56db

Browse files
committed
Add test with lower pagesize limit (test more pages)
1 parent 10791c3 commit b9d56db

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

models/repo_list_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,30 @@ func TestSearchRepositoryByName(t *testing.T) {
8484
assert.Equal(t, int64(8), count)
8585
assert.Len(t, repos, 8)
8686

87+
// Get all public + private repositories by name with pagesize limit (first page)
88+
repos, count, err = SearchRepositoryByName(&SearchRepoOptions{
89+
Keyword: "big_test_",
90+
Page: 1,
91+
PageSize: 5,
92+
Private: true,
93+
})
94+
95+
assert.NoError(t, err)
96+
assert.Equal(t, int64(8), count)
97+
assert.Len(t, repos, 5)
98+
99+
// Get all public + private repositories by name with pagesize limit (second page)
100+
repos, count, err = SearchRepositoryByName(&SearchRepoOptions{
101+
Keyword: "big_test_",
102+
Page: 2,
103+
PageSize: 5,
104+
Private: true,
105+
})
106+
107+
assert.NoError(t, err)
108+
assert.Equal(t, int64(8), count)
109+
assert.Len(t, repos, 3)
110+
87111
// Get all public repositories of user
88112
repos, count, err = SearchRepositoryByName(&SearchRepoOptions{
89113
Page: 1,

0 commit comments

Comments
 (0)