Comments to describe unresolved behavior more explicitly

pull/8387/head
Gabriel Horner 2023-01-20 16:19:19 -05:00
parent 8e47c327bf
commit 5ac1415726
2 changed files with 10 additions and 7 deletions

View File

@ -149,10 +149,13 @@ it will return 1622433600000, which is equivalent to Mon May 31 2021 00 :00:00."
(cond
(keyword? input)
(or
(resolve-keyword-input db input {:current-block-uuid current-block-uuid
:current-page-fn current-page-fn})
input)
(resolve-keyword-input db input {:current-block-uuid current-block-uuid
:current-page-fn current-page-fn})
;; The input is returned back unresolved if a resolver communicates it
;; can't resolve it by returning nil. We may want to error if this is too
;; subtle for the user
input)
(and (string? input) (page-ref/page-ref? input))
(-> (page-ref/get-page-name input)
(string/lower-case))

View File

@ -65,7 +65,7 @@ adds rules that users often use"
:where [?b :block/page ?bp]
[?bp :block/name ?current-page]]}
{:current-page-fn nil})))
":current-page input fails gracefully when not present")
":current-page input doesn't resolve when not present")
(is (= ["child 1" "child 2"]
(let [block-uuid (-> (db-utils/q '[:find (pull ?b [:block/uuid])
@ -86,7 +86,7 @@ adds rules that users often use"
:query '[:find (pull ?b [*])
:in $ ?current-block
:where [?b :block/parent ?current-block]]})))
":current-block input fails gracefuly when current-block-uuid is not provided")
":current-block input doesn't resolve when current-block-uuid is not provided")
(is (= []
(map :block/content
@ -95,7 +95,7 @@ adds rules that users often use"
:in $ ?current-block
:where [?b :block/parent ?current-block]]}
{:current-block-uuid :magic})))
":current-block input fails gracefuly when current-block-uuid is invalid")
":current-block input doesn't resolve when current-block-uuid is invalid")
(is (= ["parent"]
(let [block-uuid (-> (db-utils/q '[:find (pull ?b [:block/uuid])