Private
Public Access
28 lines
737 B
Go
28 lines
737 B
Go
package stock
|
|
|
|
import (
|
|
"testing"
|
|
|
|
ctrl "repuestera_back/controllers/stock"
|
|
)
|
|
|
|
func TestIngresarStock_Validacion(t *testing.T) {
|
|
context, recorder := newStockContext(t, "POST", "/stock/ingresos", map[string]any{
|
|
"proveedorId": 1,
|
|
"numero": "TEST",
|
|
"fechaEmision": "2026-01-01T00:00:00Z",
|
|
"almacenDestinoId": 1,
|
|
"items": []any{},
|
|
}, nil)
|
|
ctrl.IngresarStock(context)
|
|
if recorder.Code != 400 {
|
|
t.Fatalf("ingreso sin items: esperado 400, obtenido %d", recorder.Code)
|
|
}
|
|
|
|
context, recorder = newStockContext(t, "POST", "/stock/ingresos", map[string]any{}, nil)
|
|
ctrl.IngresarStock(context)
|
|
if recorder.Code != 400 {
|
|
t.Fatalf("ingreso vacío: esperado 400, obtenido %d", recorder.Code)
|
|
}
|
|
}
|