mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Check the value type before casting it to the string * set visualization as table by default * append all values for show diagnostics * golangci-lint * append metadata only to first frame
24 lines
457 B
Go
24 lines
457 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestParseString(t *testing.T) {
|
|
t.Run("parse bool value to string", func(t *testing.T) {
|
|
val := true
|
|
expected := ToPtr("true")
|
|
result := ParseString(val)
|
|
require.Equal(t, expected, result)
|
|
})
|
|
|
|
t.Run("parse number value to string", func(t *testing.T) {
|
|
val := 123
|
|
expected := ToPtr("123")
|
|
result := ParseString(val)
|
|
require.Equal(t, expected, result)
|
|
})
|
|
}
|