Stands up the LambdaMail monorepo per PLAN.md's F0 milestone: local dev scaffolding (.env.example, Makefile, .gitignore excluding PLAN.md/docs/ .superpowers/), the full initial Postgres schema as a golang-migrate migration, the complete Go domain layer for services/protocols (value objects, entities, domain events - zero external imports beyond github.com/google/uuid) with unit tests, health-checked service skeletons for auth/storage (TypeScript) and webmail (Next.js), a local docker-compose.yaml wiring all services together, a language-enforcement lint script, and a GitHub Actions CI workflow. Built via 11 sequential tasks under subagent-driven development, each with an independent implementer + reviewer cycle. Fixes applied during review: DomainName.IsPunycode() added to satisfy the promised interface; ioredis default-import typing under NodeNext; next.js bumped 15.0.3->15.5.21 to resolve high/critical CVEs; lang-lint.mjs corrected to not flag its own banned-terms list; web service healthcheck added so compose --wait actually waits on it; webmail Dockerfile's missing public/ directory: protocols go.mod version aligned with CI's Go 1.22 pin. Known follow-ups for later phases (not blocking F0): go-arch-lint isn't wired into CI yet; live docker compose up and migration apply have not been exercised in this dev environment (no Docker/psql available here) and will get their first real run in CI, which does have Docker.
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package valueobject
|
|
|
|
import "testing"
|
|
|
|
func TestNewDomainName_AcceptsValidFQDN(t *testing.T) {
|
|
d, err := NewDomainName("Example.COM")
|
|
if err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if d.String() != "example.com" {
|
|
t.Errorf("String() = %q, want lowercased %q", d.String(), "example.com")
|
|
}
|
|
}
|
|
|
|
func TestNewDomainName_RejectsEmpty(t *testing.T) {
|
|
if _, err := NewDomainName(""); err == nil {
|
|
t.Fatal("expected error for empty domain name, got nil")
|
|
}
|
|
}
|
|
|
|
func TestNewDomainName_RejectsLabelWithoutDot(t *testing.T) {
|
|
if _, err := NewDomainName("localhost"); err == nil {
|
|
t.Fatal("expected error for single-label name (not a FQDN), got nil")
|
|
}
|
|
}
|
|
|
|
func TestNewDomainName_RejectsTrailingHyphenLabel(t *testing.T) {
|
|
if _, err := NewDomainName("bad-.example.com"); err == nil {
|
|
t.Fatal("expected error for label ending in hyphen, got nil")
|
|
}
|
|
}
|
|
|
|
func TestDomainName_IsPunycode_WithPunycodeLabel(t *testing.T) {
|
|
d, err := NewDomainName("xn--exmple-cua.com")
|
|
if err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if !d.IsPunycode() {
|
|
t.Error("IsPunycode() = false, want true for punycode domain")
|
|
}
|
|
}
|
|
|
|
func TestDomainName_IsPunycode_WithoutPunycodeLabel(t *testing.T) {
|
|
d, err := NewDomainName("example.com")
|
|
if err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
if d.IsPunycode() {
|
|
t.Error("IsPunycode() = true, want false for plain ASCII domain")
|
|
}
|
|
}
|