Single-page site with gallery by album and event, contact form over SMTP, Docker dev/prod setup, and on-server image derivatives. Gallery photos stay local (app/images/ is gitignored). Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
669 B
Go
28 lines
669 B
Go
package contact
|
|
|
|
import "testing"
|
|
|
|
func TestParse_valid(t *testing.T) {
|
|
sub, errs := Parse("Jimmy", "jim@example.com", "Hello there, this is a test message.")
|
|
if errs.Any() {
|
|
t.Fatalf("unexpected errors: %v", errs)
|
|
}
|
|
if sub.Name != "Jimmy" || sub.Email != "jim@example.com" {
|
|
t.Fatalf("got %+v", sub)
|
|
}
|
|
}
|
|
|
|
func TestParse_shortMessage(t *testing.T) {
|
|
_, errs := Parse("Jimmy", "jim@example.com", "short")
|
|
if !errs.Any() {
|
|
t.Fatal("expected validation error")
|
|
}
|
|
}
|
|
|
|
func TestParse_invalidEmail(t *testing.T) {
|
|
_, errs := Parse("Jimmy", "not-an-email", "This message is long enough to pass.")
|
|
if errs["email"] == "" {
|
|
t.Fatal("expected email error")
|
|
}
|
|
}
|