diff --git a/exports_test.go b/exports_test.go index 5b0d4377..dc00dd40 100644 --- a/exports_test.go +++ b/exports_test.go @@ -4,7 +4,6 @@ import ( "context" "testing" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" ) @@ -43,5 +42,5 @@ func TestExportsLink(t *testing.T) { ctx := context.Background() url, err := mg.GetExportLink(ctx, "12") require.NoError(t, err) - ensure.StringContains(t, url, "/some/s3/url") + require.Contains(t, url, "/some/s3/url") } diff --git a/messages_test.go b/messages_test.go index 1a0ccf85..816f82aa 100644 --- a/messages_test.go +++ b/messages_test.go @@ -11,7 +11,6 @@ import ( "testing" "time" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4" "github.com/stretchr/testify/require" ) @@ -492,8 +491,9 @@ func TestSendEOFError(t *testing.T) { m := mailgun.NewMessage(fromUser, exampleSubject, exampleText, toUser) _, _, err := mg.Send(context.Background(), m) require.NotNil(t, err) - ensure.StringContains(t, err.Error(), "remote server prematurely closed connection: Post ") - ensure.StringContains(t, err.Error(), "EOF") + // TODO(vtopc): do not compare strings, use errors.Is or errors.As: + require.Contains(t, err.Error(), "remote server prematurely closed connection: Post ") + require.ErrorIs(t, err, io.EOF) } func TestHasRecipient(t *testing.T) { @@ -596,7 +596,7 @@ func TestAddOverrideHeader(t *testing.T) { require.Equal(t, exampleMessage, msg) require.Equal(t, exampleID, id) - ensure.StringContains(t, mg.GetCurlOutput(), "Host:") + require.Contains(t, mg.GetCurlOutput(), "Host:") } func TestOnBehalfOfSubaccount(t *testing.T) { @@ -635,7 +635,7 @@ func TestOnBehalfOfSubaccount(t *testing.T) { require.Equal(t, exampleMessage, msg) require.Equal(t, exampleID, id) - ensure.StringContains(t, mg.GetCurlOutput(), "Host:") + require.Contains(t, mg.GetCurlOutput(), "Host:") } func TestCaptureCurlOutput(t *testing.T) { @@ -664,7 +664,7 @@ func TestCaptureCurlOutput(t *testing.T) { require.Equal(t, exampleMessage, msg) require.Equal(t, exampleID, id) - ensure.StringContains(t, mg.GetCurlOutput(), "curl") + require.Contains(t, mg.GetCurlOutput(), "curl") t.Logf("%s", mg.GetCurlOutput()) } diff --git a/parse_test.go b/parse_test.go index 41878517..c857854f 100644 --- a/parse_test.go +++ b/parse_test.go @@ -6,14 +6,15 @@ import ( "testing" "time" - "github.com/facebookgo/ensure" "github.com/mailgun/mailgun-go/v4/events" "github.com/stretchr/testify/require" ) func TestParseErrors(t *testing.T) { _, err := ParseEvent([]byte("")) - ensure.StringContains(t, err.Error(), "failed to recognize event") + require.NotNil(t, err) + // TODO(vtopc): do not compare strings, use errors.Is or errors.As: + require.Contains(t, err.Error(), "failed to recognize event") _, err = ParseEvent([]byte(`{"event": "unknown_event"}`)) require.EqualError(t, err, "unsupported event: 'unknown_event'") @@ -22,7 +23,8 @@ func TestParseErrors(t *testing.T) { "event": "accepted", "timestamp": "1420255392.850187" }`)) - ensure.StringContains(t, err.Error(), "failed to parse event 'accepted'") + // TODO(vtopc): do not compare strings, use errors.Is or errors.As: + require.Contains(t, err.Error(), "failed to parse event 'accepted'") } func TestParseSuccess(t *testing.T) {