(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestCodec_Decode(t *testing.T) { |
| 76 | t.Run("OK", func(t *testing.T) { |
| 77 | codec := Codec{} |
| 78 | |
| 79 | v := map[string]any{} |
| 80 | |
| 81 | err := codec.Decode([]byte(original), v) |
| 82 | require.NoError(t, err) |
| 83 | |
| 84 | assert.Equal(t, data, v) |
| 85 | }) |
| 86 | |
| 87 | t.Run("InvalidData", func(t *testing.T) { |
| 88 | codec := Codec{} |
| 89 | |
| 90 | v := map[string]any{} |
| 91 | |
| 92 | err := codec.Decode([]byte(`invalid data`), v) |
| 93 | require.Error(t, err) |
| 94 | |
| 95 | t.Logf("decoding failed as expected: %s", err) |
| 96 | }) |
| 97 | } |