From cc665bbfc024caf50b0034b43df61f57eeb594ff Mon Sep 17 00:00:00 2001 From: Chris Oakman Date: Tue, 26 Apr 2022 18:19:57 -0500 Subject: [PATCH] add test for Filter expression with value true --- test/json_path/test/json_path_test.clj | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/test/json_path/test/json_path_test.clj b/test/json_path/test/json_path_test.clj index 28dc07e..8700c11 100644 --- a/test/json_path/test/json_path_test.clj +++ b/test/json_path/test/json_path_test.clj @@ -58,7 +58,31 @@ keys-of-many-types) => [{:key 1}, {:key 3}] ;; Filter expression with boolean or operator and value true (at-path "$[?(@.key>0 || true)]" - keys-of-many-types) => keys-of-many-types) + keys-of-many-types) => keys-of-many-types + ;; Filter expression with value true + (at-path "$[?(@.key)]" + [{:some "some value"} + {:key true} + {:key false} + {:key nil} + {:key "value"} + {:key ""} + {:key 0} + {:key 1} + {:key -1} + {:key 42} + {:key {}} + {:key []}]) + => [{:key true} + {:key false} + {:key "value"} + {:key ""} + {:key 0} + {:key 1} + {:key -1} + {:key 42} + {:key {}} + {:key []}]) ;; TODO: Filter expression with different grouped operators ;; NOTE: the parser will need to be updated in order to get this test to work ; (at-path "$[?(@.a && (@.b || @.c))]"