diff --git a/auth/email_action_links_test.go b/auth/email_action_links_test.go index ba258f6f..ef4593ed 100644 --- a/auth/email_action_links_test.go +++ b/auth/email_action_links_test.go @@ -204,18 +204,16 @@ func TestEmailSignInLink(t *testing.T) { func TestEmailActionLinkNoEmail(t *testing.T) { client := &Client{} - _, err := client.EmailVerificationLink(context.Background(), "") - if err == nil { + + if _, err := client.EmailVerificationLink(context.Background(), ""); err == nil { t.Errorf("EmailVerificationLink('') = nil; want error") } - _, err = client.PasswordResetLink(context.Background(), "") - if err == nil { + if _, err := client.PasswordResetLink(context.Background(), ""); err == nil { t.Errorf("PasswordResetLink('') = nil; want error") } - _, err = client.EmailSignInLink(context.Background(), "", testActionCodeSettings) - if err == nil { + if _, err := client.EmailSignInLink(context.Background(), "", testActionCodeSettings); err == nil { t.Errorf("EmailSignInLink('') = nil; want error") } } @@ -252,8 +250,7 @@ func TestEmailSignInLinkInvalidSettings(t *testing.T) { func TestEmailSignInLinkNoSettings(t *testing.T) { client := &Client{} - _, err := client.EmailSignInLink(context.Background(), testEmail, nil) - if err == nil { + if _, err := client.EmailSignInLink(context.Background(), testEmail, nil); err == nil { t.Errorf("EmailSignInLink(nil) = %v; want = error", err) } } diff --git a/auth/user_mgt_test.go b/auth/user_mgt_test.go index 9bcd2bbb..247296c3 100644 --- a/auth/user_mgt_test.go +++ b/auth/user_mgt_test.go @@ -1142,8 +1142,7 @@ func TestSessionCookieWithoutProjectID(t *testing.T) { func TestSessionCookieWithoutIDToken(t *testing.T) { client := &Client{} - _, err := client.SessionCookie(context.Background(), "", 10*time.Minute) - if err == nil { + if _, err := client.SessionCookie(context.Background(), "", 10*time.Minute); err == nil { t.Errorf("CreateSessionCookie('') = nil; want error") } } @@ -1151,8 +1150,7 @@ func TestSessionCookieWithoutIDToken(t *testing.T) { func TestSessionCookieShortExpiresIn(t *testing.T) { client := &Client{} lessThanFiveMins := 5*time.Minute - time.Second - _, err := client.SessionCookie(context.Background(), "idToken", lessThanFiveMins) - if err == nil { + if _, err := client.SessionCookie(context.Background(), "idToken", lessThanFiveMins); err == nil { t.Errorf("SessionCookie(< 5 mins) = nil; want error") } } @@ -1160,8 +1158,7 @@ func TestSessionCookieShortExpiresIn(t *testing.T) { func TestSessionCookieLongExpiresIn(t *testing.T) { client := &Client{} moreThanTwoWeeks := 14*24*time.Hour + time.Second - _, err := client.SessionCookie(context.Background(), "idToken", moreThanTwoWeeks) - if err == nil { + if _, err := client.SessionCookie(context.Background(), "idToken", moreThanTwoWeeks); err == nil { t.Errorf("SessionCookie(> 14 days) = nil; want error") } } diff --git a/internal/http_client_test.go b/internal/http_client_test.go index e5db3a13..4d5cfd56 100644 --- a/internal/http_client_test.go +++ b/internal/http_client_test.go @@ -486,8 +486,7 @@ func TestInvalidURL(t *testing.T) { URL: "http://localhost:250/mock.url", } client := &HTTPClient{Client: http.DefaultClient} - _, err := client.Do(context.Background(), req) - if err == nil { + if _, err := client.Do(context.Background(), req); err == nil { t.Errorf("Send() = nil; want error") } } diff --git a/messaging/messaging_batch_test.go b/messaging/messaging_batch_test.go index 938afb8c..d1c04cff 100644 --- a/messaging/messaging_batch_test.go +++ b/messaging/messaging_batch_test.go @@ -359,9 +359,7 @@ func TestSendAllNonMultipartResponse(t *testing.T) { t.Fatal(err) } client.batchEndpoint = ts.URL - - _, err = client.SendAll(ctx, testMessages) - if err == nil { + if _, err = client.SendAll(ctx, testMessages); err == nil { t.Fatal("SendAll() = nil; want = error") } } @@ -379,9 +377,7 @@ func TestSendAllMalformedContentType(t *testing.T) { t.Fatal(err) } client.batchEndpoint = ts.URL - - _, err = client.SendAll(ctx, testMessages) - if err == nil { + if _, err = client.SendAll(ctx, testMessages); err == nil { t.Fatal("SendAll() = nil; want = error") } } @@ -405,9 +401,7 @@ func TestSendAllMalformedMultipartResponse(t *testing.T) { t.Fatal(err) } client.batchEndpoint = ts.URL - - _, err = client.SendAll(ctx, testMessages) - if err == nil { + if _, err = client.SendAll(ctx, testMessages); err == nil { t.Fatal("SendAll() = nil; want = error") } }