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

181 lines
4.2 KiB
Markdown

# 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
```bash
# 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
```bash
# Ouvrir DevTools → Network
# Naviguer vers /marketplace/products/:id
# Vérifier: chunk ProductDetailPage chargé dynamiquement
```
---
## 2. Reviews (R1)
### 2.1 Lister les reviews
```bash
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
```bash
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
```bash
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
```bash
# Deuxième appel POST avec le même buyer/product
# Attendu: 400/409, "review already exists"
```
### 2.5 Review sans achat
```bash
# 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
```bash
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
```bash
# Utiliser un token d'un utilisateur différent
# Attendu: 403 Forbidden
```
### 3.3 Order inexistant
```bash
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
```bash
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
```bash
# Order avec status = pending
# Attendu: 400, "order cannot be refunded"
```
### 4.3 Refund par tiers
```bash
# 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
```bash
cd apps/web && npm run storybook
# Naviguer vers Components/Features/Marketplace/ProductDetailView
# Vérifier: Default, Loading, Empty, WithReviews, Error
```
### 5.2 MSW reviews
```bash
# 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
```bash
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
```bash
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