karbe/tests/lib
Ubuntu 5607a51980
Some checks failed
CI / test (pull_request) Failing after 1m10s
feat(rental): Sprint E — emails + plugin toggle + tests
3 nouveaux templates email (best-effort, dry-run sans Resend) :
- sendRentalRequestedTenant : récap de demande au locataire (par RB)
- sendRentalRequestedProvider : nouvelle demande au prestataire
- sendRentalConfirmed : confirmation paiement reçu

Branchements :
- POST /api/rentals/checkout : envoie tenant + provider après création
  des RentalBooking (PENDING), catch global pour ne pas bloquer
- Webhook Stripe rental-bundle : envoie sendRentalConfirmed à chaque
  locataire après update CONFIRMED+SUCCEEDED

Plugin gear-rental :
- Ajout au registry (catégorie business)
- layout.tsx /materiel + /espace-prestataire avec requirePluginOr404
- requirePluginOr404 dans /panier et /mes-locations
- isPluginEnabled guard dans POST /api/rentals/checkout (404 si off)
- SiteHeader masque liens Matériel / Mes locations / Espace prestataire
  + CartBadge si plugin désactivé
- CompleteYourStay renvoie null si plugin désactivé
Décision admin → activable depuis /admin/plugins comme tous les autres.

Tests vitest (tests/lib/rentals.test.ts, 16 tests) :
- diffDays (mêmes dates, 1 nuit, 7 jours, négatif)
- parseCart (null/garbage/schéma invalide/valide/format date)
- serializeCart (updatedAt, roundtrip)
- commission formula (0%, 15%, arrondi centime)
- availability arithmetic (totalQty libre, soustractions, plancher 0)

53 tests pass total. Build OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 08:49:39 +00:00
..
booking.test.ts feat(p2): vitest + 27 tests + /api/health enrichi + /api/metrics + workflow CI 2026-06-01 02:27:14 +00:00
email.test.ts feat(p2): vitest + 27 tests + /api/health enrichi + /api/metrics + workflow CI 2026-06-01 02:27:14 +00:00
image-variants.test.ts feat: variantes responsives 320/800/1600 via sharp + srcset partout (Reels, cards, galerie, favoris) 2026-06-02 01:05:25 +00:00
password.test.ts feat(p2): vitest + 27 tests + /api/health enrichi + /api/metrics + workflow CI 2026-06-01 02:27:14 +00:00
rate-limit.test.ts feat(hardening): rate limit (signup/reset/bookings) + tâches cron + backup PostgreSQL nocturne 2026-06-01 20:16:57 +00:00
rentals.test.ts feat(rental): Sprint E — emails + plugin toggle + tests 2026-06-02 08:49:39 +00:00
reviews.test.ts feat(p2): vitest + 27 tests + /api/health enrichi + /api/metrics + workflow CI 2026-06-01 02:27:14 +00:00