summaryrefslogtreecommitdiffstats
path: root/internal/thread/thread_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/thread/thread_test.go')
-rw-r--r--internal/thread/thread_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/thread/thread_test.go b/internal/thread/thread_test.go
new file mode 100644
index 0000000..146ae0c
--- /dev/null
+++ b/internal/thread/thread_test.go
@@ -0,0 +1,18 @@
+package thread
+
+import (
+ "testing"
+
+ "aegis/internal/nntp"
+)
+
+func TestBuildUsesLastReference(t *testing.T) {
+ roots := Build([]nntp.ArticleHeader{
+ {Number: 1, MessageID: "<root@example>", Subject: "topic"},
+ {Number: 2, MessageID: "<reply@example>", References: "<root@example>"},
+ {Number: 3, MessageID: "<nested@example>", References: "<root@example> <reply@example>"},
+ })
+ if len(roots) != 1 || len(roots[0].Children) != 1 || len(roots[0].Children[0].Children) != 1 {
+ t.Fatalf("unexpected thread tree: %#v", roots)
+ }
+}