grafana/pkg/tsdb/grafana-testdata-datasource/sims/utils_test.go

31 lines
500 B
Go

package sims
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
func TestSimulationUtils(t *testing.T) {
a := map[string]any{
"hello": "world",
"bool": true,
"number": 10,
}
err := updateConfigObjectFromJSON(&a, map[string]any{
"bool": false,
"number": 5,
})
require.NoError(t, err)
cfg, err := json.MarshalIndent(a, "", " ")
require.NoError(t, err)
require.JSONEq(t, `{
"hello": "world",
"bool": false,
"number": 5
}`, string(cfg))
}