@@ -56,6 +56,46 @@ func TestFJStrings(t *testing.T) {
5656 )
5757}
5858
59+ func TestFJSkippingBlocks (t * testing.T ) {
60+ j := `{
61+ "skipped_objects_with_objects": {
62+ "num": 1,
63+ "str": "hello world",
64+ "arr": [1, "yo", { "k": "val", "arr": [1, 2, "name"] }],
65+ "obj": {
66+ "another_obj": {
67+ "name": "yo",
68+ "patterns": [{ "a": 1 }, { "b": [1, 2, 3] }, "d"]
69+ }
70+ }
71+ },
72+ "skipped_array_of_primitives": [1, 324, 534, "string"],
73+ "skipped_array_of_arrays": [[0, 1], ["lat", "lng"], [{ "name": "quamina" }, { "description": "patterns matching" }]],
74+ "requested_object": {
75+ "another_num": 1,
76+ "another_str": "hello world",
77+ "another_arr": [1, "yo", { "k": "val", "arr": [1, 2, "name"] }],
78+ "another_obj": {
79+ "key": "value"
80+ }
81+ },
82+ }`
83+ matcher := fakeMatcher ("requested_object" , "another_obj" , "key" )
84+
85+ f := newJSONFlattener ()
86+ list , err := f .Flatten ([]byte (j ), matcher )
87+ if err != nil {
88+ t .Error ("E: " + err .Error ())
89+ }
90+
91+ expectToHavePaths (t ,
92+ list ,
93+ []string {"requested_object\n another_obj\n key" },
94+ []string {`"value"` },
95+ )
96+ }
97+
98+
5999func TestFJ10Lines (t * testing.T ) {
60100 geo := fakeMatcher ("type" , "geometry" )
61101 testTrackerSelection (t , newJSONFlattener (), geo , "L0" , "testdata/cl-sample-0" , []string {"type" , "geometry\n type" }, []string {`"Feature"` , `"Polygon"` })
0 commit comments