From 64eb395dc122607ae59dce504773b8e967a13ab0 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Thu, 7 Dec 2023 21:39:40 -0300 Subject: [PATCH] fix tests that relied on the defunct PublishStatus enum. --- relay_test.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/relay_test.go b/relay_test.go index 51b2269..533e911 100644 --- a/relay_test.go +++ b/relay_test.go @@ -55,11 +55,10 @@ func TestPublish(t *testing.T) { // connect a client and send the text note rl := mustRelayConnect(ws.URL) - status, _ := rl.Publish(context.Background(), textNote) - if status != PublishStatusSucceeded { - t.Errorf("published status is %d, not %d", status, PublishStatusSucceeded) + err := rl.Publish(context.Background(), textNote) + if err == nil { + t.Errorf("should have failed to publish") } - if !published { t.Errorf("fake relay server saw no event") } @@ -85,9 +84,9 @@ func TestPublishBlocked(t *testing.T) { // connect a client and send a text note rl := mustRelayConnect(ws.URL) - status, _ := rl.Publish(context.Background(), textNote) - if status != PublishStatusFailed { - t.Errorf("published status is %d, not %d", status, PublishStatusFailed) + err := rl.Publish(context.Background(), textNote) + if err == nil { + t.Errorf("should have failed to publish") } } @@ -107,9 +106,9 @@ func TestPublishWriteFailed(t *testing.T) { rl := mustRelayConnect(ws.URL) // Force brief period of time so that publish always fails on closed socket. time.Sleep(1 * time.Millisecond) - status, err := rl.Publish(context.Background(), textNote) - if status != PublishStatusFailed { - t.Errorf("published status is %d, not %d, err: %v", status, PublishStatusFailed, err) + err := rl.Publish(context.Background(), textNote) + if err == nil { + t.Errorf("should have failed to publish") } }