Private
Public Access
27 lines
695 B
Go
27 lines
695 B
Go
package stock
|
|
|
|
import (
|
|
"testing"
|
|
|
|
ctrl "repuestera_back/controllers/stock"
|
|
)
|
|
|
|
func TestTrasladarStock_Validacion(t *testing.T) {
|
|
context, recorder := newStockContext(t, "POST", "/stock/traslados", map[string]any{}, nil)
|
|
ctrl.TrasladarStock(context)
|
|
if recorder.Code != 400 {
|
|
t.Fatalf("traslado sin datos: esperado 400, obtenido %d", recorder.Code)
|
|
}
|
|
|
|
context, recorder = newStockContext(t, "POST", "/stock/traslados", map[string]any{
|
|
"repuestoId": 1,
|
|
"almacenOrigenId": 1,
|
|
"almacenDestinoId": 1,
|
|
"cantidad": 1,
|
|
}, nil)
|
|
ctrl.TrasladarStock(context)
|
|
if recorder.Code != 422 {
|
|
t.Fatalf("traslado mismo almacén: esperado 422, obtenido %d", recorder.Code)
|
|
}
|
|
}
|