Merge pull request #354 from wneessen/test_close_on_nil

Add test for closing a nil smtpclient
This commit is contained in:
Winni Neessen 2024-11-06 10:55:59 +01:00 committed by GitHub
commit 0f46ce800e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1647,6 +1647,15 @@ func TestClient_Close(t *testing.T) {
t.Errorf("close was supposed to fail, but didn't")
}
})
t.Run("close on a nil smtpclient should return nil", func(t *testing.T) {
client, err := NewClient(DefaultHost)
if err != nil {
t.Fatalf("failed to create new client: %s", err)
}
if err = client.Close(); err != nil {
t.Errorf("failed to close the client: %s", err)
}
})
}
func TestClient_DialWithContext(t *testing.T) {