MCPcopy Index your code
hub / github.com/coder/coder / TestPagination

Function TestPagination

coderd/pagination_test.go:17–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestPagination(t *testing.T) {
18 t.Parallel()
19 const invalidValues = "Query parameters have invalid values"
20 testCases := []struct {
21 Name string
22
23 AfterID string
24 Limit string
25 Offset string
26
27 ExpectedError string
28 ExpectedParams codersdk.Pagination
29 }{
30 {
31 Name: "BadAfterID",
32 AfterID: "bogus",
33 ExpectedError: invalidValues,
34 },
35 {
36 Name: "ShortAfterID",
37 AfterID: "ff22a7b-bb6f-43d8-83e1-eefe0a1f5197",
38 ExpectedError: invalidValues,
39 },
40 {
41 Name: "LongAfterID",
42 AfterID: "cff22a7b-bb6f-43d8-83e1-eefe0a1f51972",
43 ExpectedError: invalidValues,
44 },
45 {
46 Name: "BadLimit",
47 Limit: "bogus",
48 ExpectedError: invalidValues,
49 },
50 {
51 Name: "TooHighLimit",
52 Limit: "2147483648",
53 ExpectedError: invalidValues,
54 },
55 {
56 Name: "NegativeLimit",
57 Limit: "-1",
58 ExpectedError: invalidValues,
59 },
60 {
61 Name: "BadOffset",
62 Offset: "bogus",
63 ExpectedError: invalidValues,
64 },
65 {
66 Name: "TooHighOffset",
67 Offset: "2147483648",
68 ExpectedError: invalidValues,
69 },
70 {
71 Name: "NegativeOffset",
72 Offset: "-1",
73 ExpectedError: invalidValues,
74 },

Callers

nothing calls this directly

Calls 6

ParsePaginationFunction · 0.92
EncodeMethod · 0.80
RunMethod · 0.65
SetMethod · 0.65
EqualMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected