MCPcopy Create free account
hub / github.com/akash-network/node / TestEncodePaginationKey

Function TestEncodePaginationKey

util/query/pagination_test.go:9–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestEncodePaginationKey(t *testing.T) {
10 type testCase struct {
11 name string
12 states []byte
13 prefix []byte
14 key []byte
15 unsolicited []byte
16 wantOutput []byte
17 wantErr bool
18 }
19 tests := []testCase{
20 {
21 name: "fail/all params empty",
22 states: nil,
23 prefix: nil,
24 key: nil,
25 unsolicited: nil,
26 wantOutput: nil,
27 wantErr: true,
28 },
29 {
30 name: "fail/key is empty",
31 states: []byte{1},
32 prefix: []byte{2},
33 key: nil,
34 unsolicited: nil,
35 wantOutput: nil,
36 wantErr: true,
37 },
38 {
39 name: "fail/prefix is empty",
40 states: []byte{1},
41 prefix: nil,
42 key: []byte{3},
43 unsolicited: nil,
44 wantOutput: nil,
45 wantErr: true,
46 },
47 {
48 name: "fail/states is empty",
49 states: nil,
50 prefix: []byte{2},
51 key: []byte{3},
52 unsolicited: nil,
53 wantOutput: nil,
54 wantErr: true,
55 },
56 {
57 name: "pass/all params valid",
58 states: []byte{1},
59 prefix: []byte{2},
60 key: []byte{3},
61 unsolicited: nil,
62 wantOutput: []byte{0x7c, 0xd4, 0x88, 0x46, 0x1, 0x1, 0x1, 0x2, 0x1, 0x3},
63 wantErr: false,
64 },
65 {
66 name: "pass/all params valid with unsolicited",

Callers

nothing calls this directly

Calls 3

EncodePaginationKeyFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected