mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Feat(BE-36,37,38,39): master area, customer, kandang, location, warehouse
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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))
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user