Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
Plaintext
50 lines
1.7 KiB
Plaintext
; Follow-up — conversation threading via :reply-to closure. (feed-test name got expected)
|
|
|
|
(define
|
|
S
|
|
(feed/stream
|
|
(list
|
|
(feed/normalize {:actor "a" :object "root" :at 1})
|
|
(feed/normalize {:actor "b" :object "r1" :at 2 :verb "reply" :reply-to "root"})
|
|
(feed/normalize {:actor "c" :object "r2" :at 3 :verb "reply" :reply-to "root"})
|
|
(feed/normalize {:actor "d" :object "r3" :at 4 :verb "reply" :reply-to "r1"})
|
|
(feed/normalize {:actor "e" :object "x" :at 5}))))
|
|
|
|
; ---------- direct replies ----------
|
|
|
|
(feed-test "direct replies to root" (feed/reply-count S "root") 2)
|
|
(feed-test "direct replies to r1" (feed/reply-count S "r1") 1)
|
|
(feed-test "no replies to r3" (feed/reply-count S "r3") 0)
|
|
(feed-test
|
|
"replies objects to root"
|
|
(map (fn (a) (get a :object)) (feed/items (feed/replies S "root")))
|
|
(list "r1" "r2"))
|
|
|
|
; ---------- thread closure ----------
|
|
|
|
(feed-test
|
|
"thread objects root (transitive)"
|
|
(feed/thread-objects S "root")
|
|
(list "root" "r1" "r2" "r3"))
|
|
(feed-test
|
|
"thread root chronological"
|
|
(map (fn (a) (get a :object)) (feed/items (feed/thread S "root")))
|
|
(list "root" "r1" "r2" "r3"))
|
|
(feed-test "thread size root" (feed/thread-size S "root") 4)
|
|
(feed-test
|
|
"thread excludes unrelated x"
|
|
(feed/-elem?
|
|
"x"
|
|
(map (fn (a) (get a :object)) (feed/items (feed/thread S "root"))))
|
|
false)
|
|
|
|
; ---------- sub-thread ----------
|
|
|
|
(feed-test
|
|
"thread from r1 (sub-tree)"
|
|
(map (fn (a) (get a :object)) (feed/items (feed/thread S "r1")))
|
|
(list "r1" "r3"))
|
|
(feed-test "thread size r1" (feed/thread-size S "r1") 2)
|
|
(feed-test "leaf thread is itself" (feed/thread-size S "r3") 1)
|
|
(feed-test "unrelated thread is itself" (feed/thread-size S "x") 1)
|