Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
slaughtlaught committed Dec 20, 2024
1 parent ba20534 commit 6d555c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion test/darkleaf/di/component_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
(defmacro catch-cause-data [& body]
`(try ~@body
(catch clojure.lang.ExceptionInfo e#
(mapv :data (:via (Throwable->map e#))))))
(->> e#
Throwable->map
:via
(mapv :data)))))

(defn nil-component
{::di/kind :component}
Expand Down
7 changes: 6 additions & 1 deletion test/darkleaf/di/tutorial/y_graceful_stop_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
;; It throws with original exception.
;; All other possible exceptions are added as suppressed.

(defn ex-map-wo-via [ex]
(-> ex
Throwable->map
(dissoc :via)))

(defn root
{::di/kind :component}
[{dep `dep
Expand All @@ -34,5 +39,5 @@
(di/start `root registry)
(catch Throwable ex
ex))]
(t/is (= on-start-root-ex ex))
(t/is (= (ex-map-wo-via on-start-root-ex) (ex-map-wo-via ex)))
(t/is (= [on-stop-dep-ex] (vec (.getSuppressed ex))))))

0 comments on commit 6d555c9

Please sign in to comment.