mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 13:06:32 +00:00
26 lines
578 B
Go
26 lines
578 B
Go
package mailer
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_MessageBuilder(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
mb := NewMessageBuilder().
|
|
SetBody("Hello World!").
|
|
SetSubject("Hello").
|
|
SetTo("John Doe", "john@doe.com").
|
|
SetFrom("Jane Doe", "jane@doe.com")
|
|
|
|
msg := mb.Build()
|
|
|
|
assert.Equal(t, "Hello", msg.Subject)
|
|
assert.Equal(t, "Hello World!", msg.Body)
|
|
assert.Equal(t, "John Doe", msg.To.Name)
|
|
assert.Equal(t, "john@doe.com", msg.To.Address)
|
|
assert.Equal(t, "Jane Doe", msg.From.Name)
|
|
assert.Equal(t, "jane@doe.com", msg.From.Address)
|
|
}
|