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.
This commit is contained in:
Winni Neessen 2024-11-01 18:47:21 +01:00
parent 9ca7d24f6a
commit a3fe2f88d5
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -174,6 +174,12 @@ func TestSendError_MessageID(t *testing.T) {
t.Errorf("sendError expected empty message-id, got: %s", sendErr.MessageID()) 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) { func TestSendError_Msg(t *testing.T) {