From 09133ef2a4b9d1ad3436424453b667b6545a48ab Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 21 Oct 2024 22:34:47 +0200 Subject: [PATCH] Add test for invalid SMTPAuthType Introduce a new test case to verify that `UnmarshalString` fails when given an invalid string. This ensures the robustness of the error handling in the `SMTPAuthType` unmarshalling process. --- auth_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auth_test.go b/auth_test.go index fcb017e..2b8b796 100644 --- a/auth_test.go +++ b/auth_test.go @@ -48,4 +48,10 @@ func TestSMTPAuthType_UnmarshalString(t *testing.T) { } }) } + t.Run("should fail", func(t *testing.T) { + var authType SMTPAuthType + if err := authType.UnmarshalString("invalid"); err == nil { + t.Error("UnmarshalString() should have failed") + } + }) }