mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Add tests for Msg GetBoundary method
Introduce unit tests for the GetBoundary method in the Msg type. Ensure proper functionality for messages with and without a boundary set.
This commit is contained in:
parent
b7ca41af81
commit
f2619737e8
1 changed files with 21 additions and 0 deletions
21
msg_test.go
21
msg_test.go
|
@ -3288,6 +3288,27 @@ func TestMsg_GetAttachments(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMsg_GetBoundary(t *testing.T) {
|
||||||
|
t.Run("GetBoundary", func(t *testing.T) {
|
||||||
|
message := NewMsg(WithBoundary("test"))
|
||||||
|
if message == nil {
|
||||||
|
t.Fatal("message is nil")
|
||||||
|
}
|
||||||
|
if message.GetBoundary() != "test" {
|
||||||
|
t.Errorf("GetBoundary: expected %s, got: %s", "test", message.GetBoundary())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
t.Run("GetBoundary with no boundary", func(t *testing.T) {
|
||||||
|
message := NewMsg()
|
||||||
|
if message == nil {
|
||||||
|
t.Fatal("message is nil")
|
||||||
|
}
|
||||||
|
if message.GetBoundary() != "" {
|
||||||
|
t.Errorf("GetBoundary: expected empty, got: %s", message.GetBoundary())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// checkAddrHeader verifies the correctness of an AddrHeader in a Msg based on the provided criteria.
|
// checkAddrHeader verifies the correctness of an AddrHeader in a Msg based on the provided criteria.
|
||||||
// It checks whether the AddrHeader contains the correct address, name, and number of fields.
|
// It checks whether the AddrHeader contains the correct address, name, and number of fields.
|
||||||
func checkAddrHeader(t *testing.T, message *Msg, header AddrHeader, fn string, field, wantFields int,
|
func checkAddrHeader(t *testing.T, message *Msg, header AddrHeader, fn string, field, wantFields int,
|
||||||
|
|
Loading…
Reference in a new issue