Skip to content

Commit efa70b2

Browse files
Added additional tests for matching keys of objects (#14)
Co-authored-by: Calvin Lobo <[email protected]>
1 parent f1e6cb6 commit efa70b2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pkg/jsonpath/yaml_query_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,34 @@ deeply:
205205
`,
206206
expected: []string{"object"},
207207
},
208+
{
209+
name: "All property names on a nested object",
210+
input: "$.deeply.nested.object[*]~",
211+
yaml: `
212+
deeply:
213+
nested:
214+
object:
215+
key1: value1
216+
key2: value2
217+
`,
218+
expected: []string{"key1", "key2"},
219+
},
220+
{
221+
name: "All property names on multiple nested objects",
222+
input: "$.deeply.[*].object[*]~",
223+
yaml: `
224+
deeply:
225+
nested:
226+
object:
227+
key1: value1
228+
key2: value2
229+
nested2:
230+
object:
231+
key3: value3
232+
key4: value4
233+
`,
234+
expected: []string{"key1", "key2", "key3", "key4"},
235+
},
208236
}
209237

210238
for _, test := range tests {

0 commit comments

Comments
 (0)