From 19ed8f9f896b13f8c04037d91585b6fbaf2f5464 Mon Sep 17 00:00:00 2001 From: Daniel Krol Date: Fri, 17 Jun 2022 16:15:27 -0400 Subject: [PATCH] Test missing email explicitly --- server/auth_test.go | 5 +++++ server/register_test.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/server/auth_test.go b/server/auth_test.go index e9ba5f9..f442420 100644 --- a/server/auth_test.go +++ b/server/auth_test.go @@ -169,6 +169,11 @@ func TestServerValidateAuthRequest(t *testing.T) { t.Fatalf("Expected AuthRequest with email with unexpected formatting to not successfully validate") } + authRequest = AuthRequest{DeviceId: "dId", Password: "aoeu"} + if authRequest.validate() { + t.Fatalf("Expected AuthRequest with missing email to not successfully validate") + } + authRequest = AuthRequest{DeviceId: "dId", Email: "joe@example.com"} if authRequest.validate() { t.Fatalf("Expected AuthRequest with missing password to not successfully validate") diff --git a/server/register_test.go b/server/register_test.go index c5aac5e..2cfc93c 100644 --- a/server/register_test.go +++ b/server/register_test.go @@ -59,6 +59,11 @@ func TestServerValidateRegisterRequest(t *testing.T) { t.Fatalf("Expected RegisterRequest with email with unexpected formatting to not successfully validate") } + registerRequest = RegisterRequest{Password: "aoeu"} + if registerRequest.validate() { + t.Fatalf("Expected RegisterRequest with missing email to not successfully validate") + } + registerRequest = RegisterRequest{Email: "joe@example.com"} if registerRequest.validate() { t.Fatalf("Expected RegisterRequest with missing password to not successfully validate")