Skip to content

Commit

Permalink
Adding tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Jul 28, 2024
1 parent 624e743 commit 875987a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/debezium/converters/basic_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package converters

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestJSON_Convert(t *testing.T) {
{
// Wrong data type
value, err := JSON{}.Convert(123)
assert.Nil(t, value)
assert.ErrorContains(t, err, "expected string, got int")
}
{
// JSON with duplicate values
value, err := JSON{}.Convert(`{"a": 1, "a": 2}`)
assert.Nil(t, err)
assert.Equal(t, `{"a":2}`, value)
}
}

0 comments on commit 875987a

Please sign in to comment.