veza/docs/SMOKE_TEST_V0702.md
senke 3b429e726a docs: add v0.702 scope, implementation plan, and smoke test
Define v0.702 scope (Reviews wiring, Invoices, Refunds, Product Detail route),
detailed 12-step implementation plan, and comprehensive smoke test checklist.
2026-02-23 23:52:46 +01:00

4.2 KiB

Smoke Test v0.702 — Reviews, Factures, Remboursements & Product Detail

Prérequis

  • veza-backend-api compilé et démarré (go run ./cmd/api)
  • PostgreSQL avec migrations appliquées jusqu'à 116
  • .env avec DATABASE_URL, JWT_SECRET, HYPERSWITCH_API_KEY (optionnel pour refund)
  • Utilisateur enregistré avec token JWT valide
  • Au moins 1 produit créé, 1 order completed avec license

1. Product Detail Route (W1)

1.1 Route accessible

# Frontend: naviguer vers /marketplace/products/:id
# Vérifier: la page charge avec le ProductDetailView
# Vérifier: le bouton Back redirige vers /marketplace

1.2 Lazy loading

# Ouvrir DevTools → Network
# Naviguer vers /marketplace/products/:id
# Vérifier: chunk ProductDetailPage chargé dynamiquement

2. Reviews (R1)

2.1 Lister les reviews

curl -s http://localhost:8080/api/v1/marketplace/products/{PRODUCT_ID}/reviews | jq .
# Attendu: { "success": true, "data": { "reviews": [...] } }
# Attendu: reviews triées par created_at DESC

2.2 Créer une review

curl -s -X POST http://localhost:8080/api/v1/marketplace/products/{PRODUCT_ID}/reviews \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"rating": 5, "comment": "Excellent track!"}' | jq .
# Attendu: 201 Created, review avec id, product_id, buyer_id, rating, comment

2.3 Validation rating

curl -s -X POST http://localhost:8080/api/v1/marketplace/products/{PRODUCT_ID}/reviews \
  -H "Authorization: Bearer {TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"rating": 0, "comment": "bad"}' | jq .
# Attendu: 400 Bad Request, "rating must be between 1 and 5"

2.4 Review dupliquée

# Deuxième appel POST avec le même buyer/product
# Attendu: 400/409, "review already exists"

2.5 Review sans achat

# Utiliser un token d'utilisateur qui n'a pas acheté le produit
# Attendu: 403, "you must purchase the product before reviewing"

3. Invoice PDF (F1)

3.1 Télécharger facture

curl -s -o invoice.pdf http://localhost:8080/api/v1/marketplace/orders/{ORDER_ID}/invoice \
  -H "Authorization: Bearer {TOKEN}"
# Attendu: fichier PDF valide
file invoice.pdf
# Attendu: "PDF document"

3.2 Facture d'un autre buyer

# Utiliser un token d'un utilisateur différent
# Attendu: 403 Forbidden

3.3 Order inexistant

curl -s http://localhost:8080/api/v1/marketplace/orders/00000000-0000-0000-0000-000000000000/invoice \
  -H "Authorization: Bearer {TOKEN}" | jq .
# Attendu: 404 Not Found

4. Refund (R2)

4.1 Refund buyer

curl -s -X POST http://localhost:8080/api/v1/marketplace/orders/{ORDER_ID}/refund \
  -H "Authorization: Bearer {BUYER_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"reason": "Not as described"}' | jq .
# Attendu: 200, "Refund initiated"
# Attendu: order.status = refunded
# Attendu: licenses revoked_at != null

4.2 Refund order non completed

# Order avec status = pending
# Attendu: 400, "order cannot be refunded"

4.3 Refund par tiers

# Token d'un utilisateur qui n'est ni buyer ni seller
# Attendu: 403, "you are not allowed to refund this order"

5. MSW (Storybook)

5.1 Stories ProductDetailView

cd apps/web && npm run storybook
# Naviguer vers Components/Features/Marketplace/ProductDetailView
# Vérifier: Default, Loading, Empty, WithReviews, Error

5.2 MSW reviews

# En mode MSW (npm run dev), naviguer vers /marketplace/products/:id
# Vérifier: les reviews mockées s'affichent dans la section Reviews

6. Tests automatisés

6.1 Backend

cd veza-backend-api && go test ./internal/core/marketplace/... -v -run "Review|Invoice|Refund"
# Attendu: 15 tests pass (6 reviews + 4 invoices + 5 refunds)

6.2 Frontend build

cd apps/web && npm run build
# Attendu: 0 errors, 0 warnings critiques

7. Documentation

  • docs/API_REFERENCE.md contient sections Reviews, Invoices, Refunds
  • CHANGELOG.md contient entrée v0.702
  • docs/PROJECT_STATE.md : Dernier tag = v0.702
  • docs/FEATURE_STATUS.md : section "Livré en v0.702"
  • git tag v0.702 créé sur le bon commit