Skip to content

Commit

Permalink
fix description for nil factory
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Feb 5, 2025
1 parent e035321 commit eb0edae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/darkleaf/di/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@
(extend-protocol p/FactoryDescription
nil
(description [this]
{::kind :trivial
:object nil})
{}
#_{::kind :literal-nil-or-undefined})

Object
(description [this]
Expand Down
16 changes: 4 additions & 12 deletions test/darkleaf/di/tutorial/x_inspect_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@
:description {::di/kind :ref
:key `bar
:type :required}}
{:key `bar
:description {::di/kind :trivial
:object nil}}]
{:key `bar}]
(di/inspect `foo {`foo (di/ref `bar)}))))


Expand All @@ -179,9 +177,7 @@
:dependencies {`bar :required}
:description {::di/kind :template
:template [42 (di/ref `bar)]}}
{:key `bar
:description {::di/kind :trivial
:object nil}}]
{:key `bar}]
(di/inspect `foo {`foo (di/template [42 (di/ref `bar)])}))))


Expand All @@ -193,17 +189,13 @@
:key `bar
:f str
:args ["arg"]}}
{:key `bar
:description {::di/kind :trivial
:object nil}}]
{:key `bar}]
(di/inspect `foo {`foo (di/derive `bar str "arg")}))))


(t/deftest trivial-nil-test
(t/is (= [(implicit-root `foo)
{:key `foo
:description {::di/kind :trivial
:object nil}}]
{:key `foo}]
(di/inspect `foo {`foo nil}))))


Expand Down

0 comments on commit eb0edae

Please sign in to comment.