package stock import ( "testing" ctrl "repuestera_back/controllers/stock" ) func TestRegistrarDevolucion_Validacion(t *testing.T) { context, recorder := newStockContext(t, "POST", "/stock/devoluciones", map[string]any{ "facturaId": 1, "motivo": "test", "items": []any{}, }, nil) ctrl.RegistrarDevolucion(context) if recorder.Code != 400 { t.Fatalf("devolución sin items: esperado 400, obtenido %d", recorder.Code) } context, recorder = newStockContext(t, "POST", "/stock/devoluciones", map[string]any{}, nil) ctrl.RegistrarDevolucion(context) if recorder.Code != 400 { t.Fatalf("devolución vacía: esperado 400, obtenido %d", recorder.Code) } }