fix tests that relied on the defunct PublishStatus enum.

This commit is contained in:
fiatjaf 2023-12-07 21:39:40 -03:00
parent b2170efb5a
commit 64eb395dc1
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -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")
}
}