Add Technical Kiwi website with Go, templ, and HTMX.
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>
This commit is contained in:
27
app/internal/contact/validate_test.go
Normal file
27
app/internal/contact/validate_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user