1package event23import (4 "strings"5 "testing"6)78func TestRoomReplyRoot(t *testing.T) {9 a, b := strings.Repeat("a", 64), strings.Repeat("b", 64)10 for _, test := range []struct {11 name string12 kind int13 tags [][]string14 want string15 }{16 {"root and parent", 9, [][]string{{"e", b, "", "reply", b}, {"e", a, "", "root", a}}, a},17 {"parent only", 9, [][]string{{"e", b, "", "reply"}}, b},18 {"mention is not reply", 9, [][]string{{"e", a, "", "mention"}}, ""},19 {"quote is not reply", 9, [][]string{{"q", a}}, ""},20 {"legacy", 12, [][]string{{"e", a}}, a},21 {"unmarked", 9, [][]string{{"e", a}, {"e", b}}, a},22 {"reaction", 7, [][]string{{"e", a}}, ""},23 } {24 t.Run(test.name, func(t *testing.T) {25 if got := RoomReplyRoot(Event{Kind: test.kind, Tags: test.tags}); got != test.want {26 t.Fatalf("got %q want %q", got, test.want)27 }28 })29 }30}