makeTestKey is a helper function to create a valid pagination key for testing
(t *testing.T, states, prefix, key, unsolicited []byte)
| 219 | |
| 220 | // makeTestKey is a helper function to create a valid pagination key for testing |
| 221 | func makeTestKey(t *testing.T, states, prefix, key, unsolicited []byte) []byte { |
| 222 | if len(states) == 0 { |
| 223 | t.Fatal("states cannot be empty") |
| 224 | } |
| 225 | if len(prefix) == 0 { |
| 226 | t.Fatal("prefix cannot be empty") |
| 227 | } |
| 228 | if len(key) == 0 { |
| 229 | t.Fatal("key cannot be empty") |
| 230 | } |
| 231 | |
| 232 | encoded, err := EncodePaginationKey(states, prefix, key, unsolicited) |
| 233 | if err != nil { |
| 234 | t.Fatalf("failed to encode pagination key: %v", err) |
| 235 | } |
| 236 | |
| 237 | return encoded |
| 238 | } |
no test coverage detected