From a3fe2f88d58b7107bf88bbd1ca05086fb4369bdd Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Fri, 1 Nov 2024 18:47:21 +0100 Subject: [PATCH] Add test for MessageID on nil SendError This test ensures that when MessageID is called on a nil SendError, it returns an empty string. This additional check helps verify the correct behavior of the MessageID method under nil conditions. --- senderror_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/senderror_test.go b/senderror_test.go index 3cd3a76..8584e32 100644 --- a/senderror_test.go +++ b/senderror_test.go @@ -174,6 +174,12 @@ func TestSendError_MessageID(t *testing.T) { t.Errorf("sendError expected empty message-id, got: %s", sendErr.MessageID()) } }) + t.Run("TestSendError_MessageID on nil error should return empty", func(t *testing.T) { + var sendErr *SendError + if sendErr.MessageID() != "" { + t.Error("expected empty message-id on nil-senderror") + } + }) } func TestSendError_Msg(t *testing.T) {