mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-27 12:29:58 +02:00
one live random filter test.
This commit is contained in:
@@ -66,6 +66,18 @@ func TestFilterMatching(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterMatchingLive(t *testing.T) {
|
||||
var filter Filter
|
||||
var event Event
|
||||
|
||||
json.Unmarshal([]byte(`{"kinds":[1],"authors":["a8171781fd9e90ede3ea44ddca5d3abf828fe8eedeb0f3abb0dd3e563562e1fc","1d80e5588de010d137a67c42b03717595f5f510e73e42cfc48f31bae91844d59","ed4ca520e9929dfe9efdadf4011b53d30afd0678a09aa026927e60e7a45d9244"],"since":1677033299}`), &filter)
|
||||
json.Unmarshal([]byte(`{"id":"5a127c9c931f392f6afc7fdb74e8be01c34035314735a6b97d2cf360d13cfb94","pubkey":"1d80e5588de010d137a67c42b03717595f5f510e73e42cfc48f31bae91844d59","created_at":1677033299,"kind":1,"tags":[["t","japan"]],"content":"If you like my art,I'd appreciate a coin or two!!\nZap is welcome!! Thanks.\n\n\n#japan #bitcoin #art #bananaart\nhttps://void.cat/d/CgM1bzDgHUCtiNNwfX9ajY.webp","sig":"828497508487ca1e374f6b4f2bba7487bc09fccd5cc0d1baa82846a944f8c5766918abf5878a580f1e6615de91f5b57a32e34c42ee2747c983aaf47dbf2a0255"}`), &event)
|
||||
|
||||
if !filter.Matches(&event) {
|
||||
t.Error("live filter should match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterEquality(t *testing.T) {
|
||||
if !FilterEqual(
|
||||
Filter{Kinds: []int{4, 5}},
|
||||
|
Reference in New Issue
Block a user