Private
Public Access
añadidos tests y hecho workflow de testing
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
1e74e4363e
commit
37f1741a77
12 files changed
+391
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package stock
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
ctrl "repuestera_back/controllers/stock"
|
||||
)
|
||||
|
||||
func TestReservarStock_Validacion(t *testing.T) {
|
||||
context, recorder := newStockContext(t, "POST", "/stock/reservas", map[string]any{
|
||||
"repuestoId": 1,
|
||||
"almacenId": 1,
|
||||
"cantidad": 1,
|
||||
}, nil)
|
||||
ctrl.ReservarStock(context)
|
||||
if recorder.Code != 400 {
|
||||
t.Fatalf("reserva sin cliente: esperado 400, obtenido %d", recorder.Code)
|
||||
}
|
||||
|
||||
context, recorder = newStockContext(t, "POST", "/stock/reservas", map[string]any{
|
||||
"repuestoId": 1,
|
||||
"almacenId": 1,
|
||||
"cantidad": 0,
|
||||
"clienteId": 1,
|
||||
}, nil)
|
||||
ctrl.ReservarStock(context)
|
||||
if recorder.Code != 400 {
|
||||
t.Fatalf("reserva cantidad cero: esperado 400, obtenido %d", recorder.Code)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user