Skip to content

Commit

Permalink
add test for Filter expression with value true
Browse files Browse the repository at this point in the history
  • Loading branch information
oakmac authored and cburgmer committed Apr 27, 2022
1 parent cc12380 commit cc665bb
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion test/json_path/test/json_path_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))]"
Expand Down

0 comments on commit cc665bb

Please sign in to comment.