1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-25 12:49:51 +01:00

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

This commit is contained in:
nimbleghost 2023-05-31 18:02:04 +02:00
parent 20c7650e51
commit 44913c1668

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