Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jan 30, 2024
1 parent 537f97f commit 296a8f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/babashka/json/internal/jsonista.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@

(defn write-str
([s] (write-str s nil))
([s {:keys [key-fn] :or {key-fn keyword}}] (json/write-value-as-string s (-key-fn->object-mapper key-fn))))
([s _opts] (json/write-value-as-string s (-key-fn->object-mapper nil))))

(def fns ['metosin/jsonista read-str write-str ->json-reader read])
3 changes: 2 additions & 1 deletion test/babashka/json_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
(let [rdr (json/->json-reader (java.io.StringReader. "{\"a\": 1}"))]
(is (= {:a 1} (json/read rdr))))
(testing "without keywords"
(let [rdr (json/->json-reader (java.io.StringReader. "{\"a\": 1}"))]
(let [rdr (json/->json-reader (java.io.StringReader. "{\"a\": 1}")
{:key-fn str})]
(is (= {"a" 1} (json/read rdr {:key-fn str})))))))

(deftest provider-test
Expand Down

0 comments on commit 296a8f4

Please sign in to comment.