package test import ( "net/http" "testing" "github.com/gofiber/fiber/v2" ) func TestAreaIntegration(t *testing.T) { app, db := setupIntegrationApp(t) t.Run("create area trims name", func(t *testing.T) { areaID := createArea(t, app, " Area Trim ") if got := fetchAreaName(t, db, areaID); got != "Area Trim" { t.Fatalf("expected trimmed name, got %q", got) } }) t.Run("duplicate area returns conflict", func(t *testing.T) { createArea(t, app, "Duplicate Area") resp, body := doJSONRequest(t, app, http.MethodPost, "/api/master-data/areas", map[string]any{"name": "Duplicate Area"}) if resp.StatusCode != fiber.StatusConflict { t.Fatalf("expected 409 conflict, got %d: %s", resp.StatusCode, string(body)) } }) }