Skip to content

Commit

Permalink
🌿 Add CellValueUnion test (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-support authored Nov 8, 2024
1 parent 6f9c44a commit c8f80a4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Specify files that shouldn't be modified by Fern
LICENSE
README.md
tests

# Temporary workaround due to audience filtering.
data_clip_id.go
30 changes: 30 additions & 0 deletions tests/cell_value_unions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package tests

import (
"encoding/json"
"testing"

flatfile "github.com/FlatFilers/flatfile-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCellValueUnion(t *testing.T) {
testCases := []struct {
value []byte
}{
{value: []byte("0")},
{value: []byte(`""`)},
{value: []byte("false")},
}
for _, testCase := range testCases {
t.Run(string(testCase.value), func(t *testing.T) {
cellValue := &flatfile.CellValueUnion{}
require.NoError(t, json.Unmarshal(testCase.value, cellValue))

bytes, err := json.Marshal(cellValue)
require.NoError(t, err)
assert.Equal(t, string(testCase.value), string(bytes))
})
}
}

0 comments on commit c8f80a4

Please sign in to comment.