Skip to content

Commit

Permalink
switched from ensure.DeepEqual to Len
Browse files Browse the repository at this point in the history
  • Loading branch information
vtopc committed Nov 2, 2024
1 parent cbca723 commit caba8e0
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion attachments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestMultipleAttachments(t *testing.T) {
ensure.NotNil(t, e)

ensure.DeepEqual(t, e.ID, id)
ensure.DeepEqual(t, len(e.Message.Attachments), 2)
require.Len(t, e.Message.Attachments, 2)
for _, f := range e.Message.Attachments {
t.Logf("attachment: %v\n", f)
ensure.DeepEqual(t, f.Size, 100)
Expand Down
8 changes: 4 additions & 4 deletions domains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestGetSingleDomain(t *testing.T) {

dr, err := mg.GetDomain(ctx, page[0].Name)
require.NoError(t, err)
ensure.DeepEqual(t, len(dr.ReceivingDNSRecords) != 0, true)
ensure.DeepEqual(t, len(dr.SendingDNSRecords) != 0, true)
require.True(t, len(dr.ReceivingDNSRecords) != 0)
require.True(t, len(dr.SendingDNSRecords) != 0)

t.Logf("TestGetSingleDomain: %#v\n", dr)
for _, rxd := range dr.ReceivingDNSRecords {
Expand Down Expand Up @@ -119,8 +119,8 @@ func TestDomainTracking(t *testing.T) {
require.NoError(t, err)

ensure.DeepEqual(t, info.Unsubscribe.Active, false)
ensure.DeepEqual(t, len(info.Unsubscribe.HTMLFooter) != 0, true)
ensure.DeepEqual(t, len(info.Unsubscribe.TextFooter) != 0, true)
require.True(t, len(info.Unsubscribe.HTMLFooter) != 0)
require.True(t, len(info.Unsubscribe.TextFooter) != 0)
ensure.DeepEqual(t, info.Click.Active, true)
ensure.DeepEqual(t, info.Open.Active, true)

Expand Down
4 changes: 2 additions & 2 deletions exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ func TestExports(t *testing.T) {
ctx := context.Background()
list, err := mg.ListExports(ctx, "")
require.NoError(t, err)
ensure.DeepEqual(t, len(list), 0)
require.Len(t, list, 0)

err = mg.CreateExport(ctx, "/domains")
require.NoError(t, err)

list, err = mg.ListExports(ctx, "")
require.NoError(t, err)
ensure.DeepEqual(t, len(list), 1)
require.Len(t, list, 1)

ensure.DeepEqual(t, list[0].ID, "0")
ensure.DeepEqual(t, list[0].URL, "/domains")
Expand Down
6 changes: 3 additions & 3 deletions ips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestListIPS(t *testing.T) {
ctx := context.Background()
list, err := mg.ListIPS(ctx, false)
require.NoError(t, err)
ensure.DeepEqual(t, len(list), 2)
require.Len(t, list, 2)

ip, err := mg.GetIP(ctx, list[0].IP)
require.NoError(t, err)
Expand All @@ -47,7 +47,7 @@ func TestDomainIPS(t *testing.T) {
list, err := mg.ListDomainIPS(ctx)
require.NoError(t, err)

ensure.DeepEqual(t, len(list), 1)
require.Len(t, list, 1)
ensure.DeepEqual(t, list[0].IP, "192.172.1.1")

err = mg.DeleteDomainIP(ctx, "192.172.1.1")
Expand All @@ -56,5 +56,5 @@ func TestDomainIPS(t *testing.T) {
list, err = mg.ListDomainIPS(ctx)
require.NoError(t, err)

ensure.DeepEqual(t, len(list), 0)
require.Len(t, list, 0)
}
2 changes: 1 addition & 1 deletion parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestParseErrors(t *testing.T) {
ensure.StringContains(t, err.Error(), "failed to recognize event")

_, err = ParseEvent([]byte(`{"event": "unknown_event"}`))
ensure.DeepEqual(t, err.Error(), "unsupported event: 'unknown_event'")
require.EqualError(t, err, "unsupported event: 'unknown_event'")

_, err = ParseEvent([]byte(`{
"event": "accepted",
Expand Down
2 changes: 1 addition & 1 deletion routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestRouteCRUD(t *testing.T) {
})
require.NoError(t, err)
ensure.DeepEqual(t, changedRoute.Priority, 2)
ensure.DeepEqual(t, len(changedRoute.Actions), 2)
require.Len(t, changedRoute.Actions, 2)
}

func TestRoutesIterator(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestTags(t *testing.T) {

var tags []mailgun.Tag
for cursor.Next(ctx, &tags) {
ensure.DeepEqual(t, len(tags), 1)
require.Len(t, tags, 1)
}
require.NoError(t, cursor.Err())

Expand Down
4 changes: 2 additions & 2 deletions webhooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestGetWebhook(t *testing.T) {
ctx := context.Background()
list, err := mg.ListWebhooks(ctx)
require.NoError(t, err)
ensure.DeepEqual(t, len(list), 2)
require.Len(t, list, 2)

urls, err := mg.GetWebhook(ctx, "new-webhook")
require.NoError(t, err)
Expand All @@ -40,7 +40,7 @@ func TestWebhookCRUD(t *testing.T) {
ctx := context.Background()
list, err := mg.ListWebhooks(ctx)
require.NoError(t, err)
ensure.DeepEqual(t, len(list), 2)
require.Len(t, list, 2)

var countHooks = func() int {
hooks, err := mg.ListWebhooks(ctx)
Expand Down

0 comments on commit caba8e0

Please sign in to comment.