Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

578 B
Raw Blame
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", "[email protected]").
		SetFrom("Jane Doe", "[email protected]")

	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, "[email protected]", msg.To.Address)
	assert.Equal(t, "Jane Doe", msg.From.Name)
	assert.Equal(t, "[email protected]", msg.From.Address)
}