modelRT/orm/jsonb_serializer_test.go

22 lines
435 B
Go

package orm
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestJSONMapArrayValueAndScan(t *testing.T) {
original := JSONMapArray{
{"command": float64(0), "timestamp": "2026-07-20T00:00:00Z"},
{"transaction": float64(1), "value": 15.2},
}
encoded, err := original.Value()
require.NoError(t, err)
var decoded JSONMapArray
require.NoError(t, decoded.Scan(encoded))
require.Equal(t, original, decoded)
}