Replace if err-nil-Fatal check with require.Nil

pull/751/head
nimbleghost 2023-05-31 18:02:04 +02:00
parent 20c7650e51
commit 44913c1668
1 changed files with 3 additions and 9 deletions

View File

@ -34,9 +34,7 @@ func TestServer_WebPush_TopicSubscribe(t *testing.T) {
require.Equal(t, `{"success":true}`+"\n", response.Body.String()) require.Equal(t, `{"success":true}`+"\n", response.Body.String())
subs, err := s.webPush.SubscriptionsForTopic("test-topic") subs, err := s.webPush.SubscriptionsForTopic("test-topic")
if err != nil { require.Nil(t, err)
t.Fatal(err)
}
require.Len(t, subs, 1) require.Len(t, subs, 1)
require.Equal(t, subs[0].BrowserSubscription.Endpoint, "https://example.com/webpush") require.Equal(t, subs[0].BrowserSubscription.Endpoint, "https://example.com/webpush")
@ -185,16 +183,12 @@ func addSubscription(t *testing.T, s *Server, topic string, url string) {
}, },
}, },
}) })
if err != nil { require.Nil(t, err)
t.Fatal(err)
}
} }
func requireSubscriptionCount(t *testing.T, s *Server, topic string, expectedLength int) { func requireSubscriptionCount(t *testing.T, s *Server, topic string, expectedLength int) {
subs, err := s.webPush.SubscriptionsForTopic("test-topic") subs, err := s.webPush.SubscriptionsForTopic("test-topic")
if err != nil { require.Nil(t, err)
t.Fatal(err)
}
require.Len(t, subs, expectedLength) require.Len(t, subs, expectedLength)
} }