chore: build
This commit is contained in:
@@ -3,6 +3,7 @@ package tests
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"gestion/db"
|
||||
"gestion/handlers"
|
||||
"gestion/models"
|
||||
@@ -435,7 +436,7 @@ func TestSwapMyRewardProduct_PointsDisabled_Rejected(t *testing.T) {
|
||||
func TestSwapMyRewardProduct_HalfPriceType_RecomputesPriceFromCurrentCatalog(t *testing.T) {
|
||||
cleanupStockTestData(t)
|
||||
username := newTestClient(t, "swap_reward_halfprice")
|
||||
productA := newTestProduct(t, "SwapRewardHalfA", 5) // prix catalogue 10.00€ (newTestProduct)
|
||||
productA := newTestProduct(t, "SwapRewardHalfA", 5) // prix catalogue 10.00€ (newTestProduct)
|
||||
productB := newTestProduct(t, "SwapRewardHalfB", 5)
|
||||
if err := testDB.GDB.Exec(
|
||||
`UPDATE product_prices SET price = 30.00 WHERE product_id = ? AND quantity = 1`,
|
||||
@@ -671,8 +672,8 @@ func TestCancelDeliveryByLivreurAtomic_AlreadyApproved_DoesNotTouchPoints(t *tes
|
||||
cmdID := newTestCommandWithItem(t, username, "approved", testUserPrefix+"livreurY", paidProductID, 1, 10)
|
||||
insertRewardCommandItem(t, cmdID, rewardProductID, 1, 0, "pool_0")
|
||||
|
||||
if _, _, err := testDB.CancelDeliveryByLivreurAtomic(cmdID); err != nil {
|
||||
t.Fatalf("CancelDeliveryByLivreurAtomic: %v", err)
|
||||
if _, _, err := testDB.CancelDeliveryByLivreurAtomic(cmdID); !errors.Is(err, db.ErrCommandAlreadyDelivered) {
|
||||
t.Fatalf("une commande approuvée ne doit pas être annulable par le livreur: err=%v", err)
|
||||
}
|
||||
|
||||
if got := clientPointsRedeemed(t, username)["pool_0"]; got != 5 {
|
||||
@@ -736,8 +737,8 @@ func TestUpdateCommandStatusAdmin_AlreadyApprovedWithRewardItem_DoesNotTouchPoin
|
||||
|
||||
c, rec := adminCancelCtx(cmdID)
|
||||
handlers.UpdateCommandStatusAdmin(c)
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status HTTP: got=%d body=%s", rec.Code, rec.Body.String())
|
||||
if rec.Code != http.StatusConflict {
|
||||
t.Fatalf("une commande approuvée ne doit pas être annulable: got=%d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
|
||||
if got := clientPointsRedeemed(t, username)["pool_0"]; got != 3 {
|
||||
@@ -821,4 +822,3 @@ func TestCalculateAndAddPointsForCommandTx_MultipleRewardRowsSamePool_Decrements
|
||||
t.Errorf("redeemed après approbation (2 lignes, même pool, une seule réservation): got=%d want=1", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user