Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie committed Jun 13, 2024
1 parent b5c9fec commit 6b505bd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions clients/bigquery/cast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bigquery
import (
"fmt"
"math/big"
"testing"
"time"

"github.com/artie-labs/transfer/lib/ptr"
Expand Down Expand Up @@ -160,3 +161,24 @@ func (b *BigQueryTestSuite) TestCastColVal() {
assert.Nil(b.T(), colVal)
}
}

func TestEncodeStructToJSONString(t *testing.T) {
{
// Empty string:
result, err := EncodeStructToJSONString("")
assert.NoError(t, err)
assert.Equal(t, "", result)
}
{
// Toasted string:
result, err := EncodeStructToJSONString("__debezium_unavailable_value")
assert.NoError(t, err)
assert.Equal(t, `{"key":"__debezium_unavailable_value"}`, result)
}
{
// Map:
result, err := EncodeStructToJSONString(map[string]any{"foo": "bar", "baz": 1234})
assert.NoError(t, err)
assert.Equal(t, `{"baz":1234,"foo":"bar"}`, result)
}
}

0 comments on commit 6b505bd

Please sign in to comment.