(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func TestDecodeCursorMalformed(t *testing.T) { |
| 50 | var out struct{ A string } |
| 51 | // Not valid base64url and no signature segment. |
| 52 | if err := DecodeCursor([]string{testSecret}, "!!!not-base64!!!", &out); err != ErrInvalidCursor { |
| 53 | t.Fatalf("want ErrInvalidCursor, got %v", err) |
| 54 | } |
| 55 | // Valid base64url payload + valid signature, but the payload is not the |
| 56 | // dst struct shape (a bare string). |
| 57 | bad := EncodeMust(t, testSecret, "a string, not the struct") |
| 58 | if err := DecodeCursor([]string{testSecret}, bad, &out); err != ErrInvalidCursor { |
| 59 | t.Fatalf("want ErrInvalidCursor on bad json, got %v", err) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestDecodeCursorTamperedPayload(t *testing.T) { |
| 64 | type cur struct { |
nothing calls this directly
no test coverage detected