MCPcopy
hub / github.com/getsops/sops / TestDecodeJSONWithArray

Function TestDecodeJSONWithArray

stores/json/store_test.go:213–233  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

211}
212
213func TestDecodeJSONWithArray(t *testing.T) {
214 in := `{"foo": {"foo": [1, 2, 3]}, "bar": "baz"}`
215 expected := sops.TreeBranch{
216 sops.TreeItem{
217 Key: "foo",
218 Value: sops.TreeBranch{
219 sops.TreeItem{
220 Key: "foo",
221 Value: []interface{}{1, 2, 3},
222 },
223 },
224 },
225 sops.TreeItem{
226 Key: "bar",
227 Value: "baz",
228 },
229 }
230 branch, err := Store{}.treeBranchFromJSON([]byte(in))
231 assert.Nil(t, err)
232 assert.Equal(t, expected, branch)
233}
234
235func TestDecodeJSONArrayOfObjects(t *testing.T) {
236 in := `{"foo": [{"bar": "foo"}, {"foo": "bar"}]}`

Callers

nothing calls this directly

Calls 1

treeBranchFromJSONMethod · 0.80

Tested by

no test coverage detected