Skip to content

Commit

Permalink
fix test conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Apr 17, 2023
1 parent dbe8865 commit abab957
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/malli/dev_err_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[malli.dev.pretty :as pretty]))

(defn plus-err
{:malli/schema [:=> [:cat [:vector]] [:int {:max 6}]]}
[x] (inc x))

(defn ->plus-err [] plus-err)
Expand All @@ -16,8 +15,13 @@
(is (= 7 ((->plus-err) 6))))

(testing "instrumentation shema error when starting"
(is (thrown-with-msg?
Exception #"Schema error when insrumenting function: malli.dev-err-test/plus-err - :malli.core/child-error"
(md/start! {:ns *ns*})))
(md/stop!))))
;; append metadata only during test to prevent conflicts with other tests
(alter-meta! #'plus-err #(assoc % :malli/schema [:=> [:cat [:vector]] [:int {:max 6}]]))
(try
(is (thrown-with-msg?
Exception #"Schema error when insrumenting function: malli.dev-err-test/plus-err - :malli.core/child-error"
(md/start! {:ns *ns*})))
(catch Throwable _
(md/stop!)))
(alter-meta! #'plus-err #(dissoc % :malli/schema)))))

0 comments on commit abab957

Please sign in to comment.