this commit also remove all the sonic envelope parsing and reintroduces filters in REQ as a slice instead of as a singleton. why? well, the sonic stuff wasn't really that fast, it was a little bit but only got fast enough once I introduced unsafe conversions between []byte and string and did weird unsafe reuse of []byte in order to save the values of tags, which would definitely cause issues in the future if the caller wasn't aware of it (and even if they were, like myself). and the filters stuff is because we abandoned the idea of changing NIP-01 to only accept one filter per REQ.
22 lines
487 B
Go
22 lines
487 B
Go
package nostr
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCount(t *testing.T) {
|
|
const RELAY = "wss://chorus.pjv.me"
|
|
|
|
rl := mustRelayConnect(t, RELAY)
|
|
defer rl.Close()
|
|
|
|
count, _, err := rl.Count(context.Background(), Filter{
|
|
Kinds: []Kind{KindFollowList}, Tags: TagMap{"p": []string{"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"}},
|
|
}, SubscriptionOptions{})
|
|
assert.NoError(t, err)
|
|
assert.Greater(t, count, uint32(0))
|
|
}
|