1package event23import (4 "reflect"5 "testing"67 "github.com/FelineStateMachine/tinyrelay/protocol/nostr"8)910func TestCompatibilityPreservesPublicTypeIdentity(t *testing.T) {11 if reflect.TypeOf(Event{}).PkgPath() != reflect.TypeOf(nostr.Event{}).PkgPath() || reflect.TypeOf(Filter{}).PkgPath() != reflect.TypeOf(nostr.Filter{}).PkgPath() {12 t.Fatal("compatibility values must alias the public types")13 }14}1516func TestPrivateKindClassificationAndSearchCompatibility(t *testing.T) {17 if !IsPrivate(4) || IsPrivate(KIND_DM) {18 t.Fatal("kind classification mismatch")19 }20 for _, kind := range []int{4, 13, KIND_WRAP, 21059, KIND_NOSTR_CONNECT, KIND_PUSH_REGISTRATION} {21 e := Event{Kind: kind, Content: "hello world"}22 if Matches(Filter{Search: "hello"}, e) {23 t.Errorf("private kind %d matched content search", kind)24 }25 if !Matches(Filter{Search: "lang:en"}, e) || !Matches(Filter{}, e) {26 t.Errorf("private kind %d changed non-content matching", kind)27 }28 }29 if !Matches(Filter{Search: "HELLO"}, Event{Kind: 1, Content: "hello world"}) {30 t.Fatal("public content no longer matches")31 }32}