Skip to content

Commit

Permalink
Adding more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Dec 12, 2024
1 parent 4d3e5e0 commit e73190e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/debezium/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ func TestField_ParseValue(t *testing.T) {
assert.Equal(t, `[[{"foo":"bar"}],[{"hello":"world"},{"dusty":"the mini aussie"}]]`, val)
}
}
{
// Array
field := Field{Type: Array, Items: Item{DebeziumType: JSON}}
value, err := field.ParseValue([]any{`{"foo": "bar", "foo": "bar"}`, `{"hello": "world"}`})
assert.NoError(t, err)
assert.Len(t, value.([]any), 2)
assert.Equal(t, map[string]any{"foo": "bar"}, value.([]any)[0])
assert.Equal(t, map[string]any{"hello": "world"}, value.([]any)[1])
}
{
// Int32
value, err := Field{Type: Int32}.ParseValue(float64(3))
Expand Down

0 comments on commit e73190e

Please sign in to comment.