Files
zooid/zooid/groups_test.go
T
2025-10-25 06:57:18 -07:00

42 lines
685 B
Go

package zooid
import (
"testing"
"fiatjaf.com/nostr"
)
func TestGetGroupIDFromEvent(t *testing.T) {
tests := []struct {
name string
tags nostr.Tags
want string
}{
{
name: "with h tag",
tags: nostr.Tags{{"h", "group123"}},
want: "group123",
},
{
name: "without h tag",
tags: nostr.Tags{{"p", "pubkey123"}},
want: "",
},
{
name: "empty tags",
tags: nostr.Tags{},
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
event := nostr.Event{Tags: tt.tags}
result := GetGroupIDFromEvent(event)
if result != tt.want {
t.Errorf("GetGroupIDFromEvent() = %v, want %v", result, tt.want)
}
})
}
}