Collection Bruno (.bru text files, comme Postman mais file-based versionable) qui couvre l'API V1 actuelle. Open Collection → bruno/ → sélectionner l'environnement "local". Domaines couverts (22 requêtes) : - 00-Auth : Signup, Login, Logout - 01-Account : Get/Update profile - 02-Organizations : Get/Update my org - 03-Clients : List, List+stats, Search, Create, Create duplicate (409), Create without email (422), Get detail, Update - 04-Plans : List, Get by slug, Update (steps remplacés) - 05-Invoices : List, List+filters, Counts, Create, Get detail, Mark paid Environnement local (bruno/environments/local.bru) : - baseUrl, email/password/fullName en dur - token, userId, organizationId, clientId, invoiceId remplis automatiquement par les script:post-response Chaque requête a : - assertions Chai (statut, shape de la réponse) - bloc docs avec sémantique métier + erreurs typiques - inheritance auth Bearer via folder.bru pour ne pas répéter le header Mise à jour de docs/tech/dev-setup.md pour pointer vers la collection. Le parcours recommandé Signup → Update org → Create client → Create invoice → Mark paid couvre le happy path et permet de checker rubisCount qui s'incrémente.
43 lines
903 B
Plaintext
43 lines
903 B
Plaintext
meta {
|
|
name: 02 List with stats
|
|
type: http
|
|
seq: 2
|
|
}
|
|
|
|
get {
|
|
url: {{baseUrl}}/api/v1/clients?withStats=1
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
params:query {
|
|
withStats: 1
|
|
}
|
|
|
|
tests {
|
|
test("200 OK", function () {
|
|
expect(res.getStatus()).to.equal(200);
|
|
});
|
|
test("clients are enriched", function () {
|
|
const list = res.getBody().data;
|
|
if (list.length > 0) {
|
|
expect(list[0]).to.have.property("invoiceCount");
|
|
expect(list[0]).to.have.property("lateInvoiceCount");
|
|
expect(list[0]).to.have.property("paidLifetimeCents");
|
|
}
|
|
});
|
|
}
|
|
|
|
docs {
|
|
GET /api/v1/clients?withStats=1
|
|
|
|
Liste enrichie pour la page /clients. Chaque client expose :
|
|
- `invoiceCount` (total)
|
|
- `activeInvoiceCount` / `lateInvoiceCount`
|
|
- `paidInvoiceCount` / `paidLifetimeCents`
|
|
- `pendingLifetimeCents`
|
|
- `lastActivityAt`
|
|
|
|
Tri : retards d'abord (actionnable), puis activité récente.
|
|
}
|