mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-12-10 04:41:10 +01:00
support CLOSED messages.
This commit is contained in:
@@ -88,6 +88,19 @@ func TestOKEnvelopeEncodingAndDecoding(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestClosedEnvelopeEncodingAndDecoding(t *testing.T) {
|
||||
src := `["CLOSED","_","error: something went wrong"]`
|
||||
var env ClosedEnvelope
|
||||
json.Unmarshal([]byte(src), &env)
|
||||
if env.SubscriptionID != "_" {
|
||||
t.Error("failed to decode CLOSED")
|
||||
}
|
||||
|
||||
if res, _ := json.Marshal(env); string(res) != src {
|
||||
t.Errorf("failed to encode CLOSED: expected '%s', got '%s'", src, string(res))
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthEnvelopeEncodingAndDecoding(t *testing.T) {
|
||||
authEnvelopes := []string{
|
||||
`["AUTH","kjsabdlasb aslkd kasndkad \"as.kdnbskadb"]`,
|
||||
|
||||
Reference in New Issue
Block a user