From a364f55fefef1f5976c3f1b9786e41cb3d21ea75 Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Tue, 17 Nov 2020 13:44:51 +0000 Subject: [PATCH] Add test for putting an empty object --- internal/command/root_put_test.go | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/internal/command/root_put_test.go b/internal/command/root_put_test.go index 6cdd58b4..3716c93d 100644 --- a/internal/command/root_put_test.go +++ b/internal/command/root_put_test.go @@ -263,6 +263,39 @@ func TestRootCMD_Put_JSON(t *testing.T) { ] }`, nil)) + t.Run("EmptyObject", putObjectTest(`{ + "numbers": [ + { + "rank": 1, + "number": "one" + }, + { + "rank": 2, + "number": "two" + }, + { + "rank": 3, + "number": "three" + } + ] +}`, "json", ".numbers.[]", []string{}, []string{}, `{ + "numbers": [ + { + "number": "one", + "rank": 1 + }, + { + "number": "two", + "rank": 2 + }, + { + "number": "three", + "rank": 3 + }, + {} + ] +}`, nil)) + t.Run("AppendObjectMulti", putObjectTest(`{ "numbers": [ {