26 lines
753 B
Fennel
26 lines
753 B
Fennel
(local { : view } (require :fennel))
|
|
|
|
(local history (require :history))
|
|
|
|
(local fake-time
|
|
(let []
|
|
(var previous 1672682104)
|
|
(fn []
|
|
(doto previous
|
|
(+ 1)))))
|
|
|
|
(let [h (history.open)]
|
|
(h:visit "http://example.com" (fake-time))
|
|
(let [actual (h:find "example.com")]
|
|
(match actual
|
|
(where [{:url "http://example.com" :timestamp t}] (> t 0)) true
|
|
?fail (assert false (view ?fail)))))
|
|
|
|
(let [h (history.open)]
|
|
(h:visit "http://example.com" (fake-time))
|
|
(h:title "http://example.com" "Page title")
|
|
(let [actual (h:find "example.com")]
|
|
(match actual
|
|
(where [{:url "http://example.com" :title "Page title" :timestamp t}] (> t 0)) true
|
|
?fail (assert false (view ?fail)))))
|