Skip to content

Commit 6d9c1d6

Browse files
committed
wip3
1 parent 88e9f1a commit 6d9c1d6

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

test/darkleaf/di/dependencies_test.clj

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,32 @@
1111
;; c
1212

1313
(defn root
14-
{::di/stop #(swap! % conj [`root :stopped])}
15-
[{a `a, b `b, log ::log}]
16-
(swap! log conj [`root :built])
17-
log)
14+
{::di/kind :component}
15+
[{a `a, b `b}]
16+
:root)
1817

1918
(defn a
20-
{::di/stop #(swap! % conj [`a :stopped])}
21-
[{c `c, log ::log}]
22-
(swap! log conj [`a :built])
23-
log)
19+
{::di/kind :component}
20+
[{c `c}]
21+
:a)
2422

2523
(defn b
26-
{::di/stop #(swap! % conj [`b :stopped])}
27-
[{c `c, log ::log}]
28-
(swap! log conj [`b :built])
29-
log)
24+
{::di/kind :component}
25+
[{c `c}]
26+
:b)
3027

3128
(defn c
32-
{::di/stop #(swap! % conj [`c :stopped])}
33-
[{log ::log}]
34-
(swap! log conj [`c :built])
35-
log)
29+
{::di/kind :component}
30+
[]
31+
:c)
3632

3733
(t/deftest order-test
38-
(let [log (atom [])]
39-
(-> (di/start `root {::log log})
40-
(di/stop))
34+
(let [log (atom [])
35+
built! (fn [key obj]
36+
(swap! log conj [key :built]))
37+
demolish! (fn [key obj]
38+
(swap! log conj [key :stopped]))]
39+
(with-open [root (di/start `root (di/log built! demolish!))])
4140
(t/is (= [[`c :built]
4241
[`a :built]
4342
[`b :built]

0 commit comments

Comments
 (0)