MCPcopy Create free account
hub / github.com/conforma/cli / TestIsJson

Function TestIsJson

internal/utils/helpers_test.go:47–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestIsJson(t *testing.T) {
48 tests := []struct {
49 name string
50 data string
51 want bool
52 }{
53 {
54 name: "valid JSON",
55 data: `{"name": "ec"}`,
56 want: true,
57 },
58 {
59 name: "invalid JSON",
60 data: `{"name": "ec"`,
61 want: false,
62 },
63 {
64 name: "empty string",
65 data: "",
66 want: false,
67 },
68 }
69
70 for _, tt := range tests {
71 t.Run(tt.name, func(t *testing.T) {
72 got := IsJson(tt.data)
73 assert.Equal(t, tt.want, got)
74 })
75 }
76}
77
78func TestIsYamlMap(t *testing.T) {
79 tests := []struct {

Callers

nothing calls this directly

Calls 2

IsJsonFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected