mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-21 21:30:50 +01:00
Refactor header test structure and improve readability
Simplify test structure by renaming fields for clarity and brevity. AddressHeader tests and importance tests now use more concise and consistent naming conventions. This enhances readability and maintainability of the test code.
This commit is contained in:
parent
143e3b5b4f
commit
9505f94e3d
1 changed files with 15 additions and 15 deletions
|
@ -46,13 +46,13 @@ var (
|
||||||
}
|
}
|
||||||
addrHeaderTests = []struct {
|
addrHeaderTests = []struct {
|
||||||
name string
|
name string
|
||||||
ah AddrHeader
|
header AddrHeader
|
||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{"Address header: From", HeaderFrom, "From"},
|
{"From", HeaderFrom, "From"},
|
||||||
{"Address header: To", HeaderTo, "To"},
|
{"To", HeaderTo, "To"},
|
||||||
{"Address header: Cc", HeaderCc, "Cc"},
|
{"Cc", HeaderCc, "Cc"},
|
||||||
{"Address header: Bcc", HeaderBcc, "Bcc"},
|
{"Bcc", HeaderBcc, "Bcc"},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -64,12 +64,12 @@ func TestImportance_Stringer(t *testing.T) {
|
||||||
xprio string
|
xprio string
|
||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{"Importance: Non-Urgent", ImportanceNonUrgent, "0", "5", "non-urgent"},
|
{"Non-Urgent", ImportanceNonUrgent, "0", "5", "non-urgent"},
|
||||||
{"Importance: Low", ImportanceLow, "0", "5", "low"},
|
{"Low", ImportanceLow, "0", "5", "low"},
|
||||||
{"Importance: Normal", ImportanceNormal, "", "", ""},
|
{"Normal", ImportanceNormal, "", "", ""},
|
||||||
{"Importance: High", ImportanceHigh, "1", "1", "high"},
|
{"High", ImportanceHigh, "1", "1", "high"},
|
||||||
{"Importance: Urgent", ImportanceUrgent, "1", "1", "urgent"},
|
{"Urgent", ImportanceUrgent, "1", "1", "urgent"},
|
||||||
{"Importance: Unknown", 9, "", "", ""},
|
{"Unknown", 9, "", "", ""},
|
||||||
}
|
}
|
||||||
t.Run("String", func(t *testing.T) {
|
t.Run("String", func(t *testing.T) {
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -105,9 +105,9 @@ func TestImportance_Stringer(t *testing.T) {
|
||||||
func TestAddrHeader_Stringer(t *testing.T) {
|
func TestAddrHeader_Stringer(t *testing.T) {
|
||||||
for _, tt := range addrHeaderTests {
|
for _, tt := range addrHeaderTests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if tt.ah.String() != tt.want {
|
if tt.header.String() != tt.want {
|
||||||
t.Errorf("wrong string for AddrHeader returned. Expected: %s, got: %s",
|
t.Errorf("wrong string for AddrHeader returned. Expected: %s, got: %s",
|
||||||
tt.want, tt.ah.String())
|
tt.want, tt.header.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue