Add explicit tests for :+X-ms and :-X-ms

pull/8387/head
Ben Yorke 2023-01-18 14:40:12 +01:00
parent 5e0d0d4bbe
commit 417630590a
1 changed files with 24 additions and 0 deletions

View File

@ -106,6 +106,30 @@ created-at:: %s"
(inc today-timestamp)
next-week-timestamp)}])
(is (= ["today"]
(map #(-> % :block/content string/split-lines first)
(custom-query {:inputs [:-0d-ms :+0d-ms]
:query '[:find (pull ?b [*])
:in $ ?start ?end
:where
[?b :block/content]
[?b :block/created-at ?timestamp]
[(>= ?timestamp ?start)]
[(<= ?timestamp ?end)]]})))
":+0d-ms and :-0d-ms resolve to correct datetime range")
(is (= ["yesterday" "today"]
(map #(-> % :block/content string/split-lines first)
(custom-query {:inputs [:-1d-ms :+5d-ms]
:query '[:find (pull ?b [*])
:in $ ?start ?end
:where
[?b :block/content]
[?b :block/created-at ?timestamp]
[(>= ?timestamp ?start)]
[(<= ?timestamp ?end)]]})))
":-Xd-ms and :+Xd-ms resolve to correct datetime range")
(is (= ["today"]
(map #(-> % :block/content string/split-lines first)
(custom-query {:inputs [:start-of-today-ms :end-of-today-ms]