Skip to content

Commit 1237ec7

Browse files
committed
chore: add endpoint coverage documentation and update test scripts
- Introduced to document API definitions and client method mappings. - Updated to include coverage directory. - Enhanced and with new dependencies for coverage reporting. - Added unit tests for beneficiaries, consent history, pay links, and recurring payments. - Refactored test scripts to include coverage options for unit and integration tests.
1 parent 6af9f64 commit 1237ec7

29 files changed

+2557
-78
lines changed

.eslintrc.json

Lines changed: 0 additions & 68 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ dist/
1010
.idea/
1111
.DS_Store
1212
.vscode/settings.json
13+
coverage

.npmignore

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
# IDE and tooling
2+
.cursor
13
.github
24
.husky
5+
.vscode
6+
7+
# Dev and config directories
38
config
49
examples
510
resources
11+
12+
# Source and tests (publish dist/ only; exclude compiled tests)
613
src
714
test
815
__tests__
9-
.eslintrc.json
10-
tsconfig.json
16+
dist/__tests__
17+
18+
# Build and lint config
19+
eslint.config.js
20+
tsconfig.json
21+
22+
# Build artefacts and caches
23+
coverage
24+
.dccache
25+
*.tsbuildinfo
26+
27+
# Internal documentation
28+
ENDPOINT_COVERAGE.md
29+
30+
# Local environment
31+
.env
32+
.env.*

ENDPOINT_COVERAGE.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Endpoint coverage: Swagger / API definition vs client
2+
3+
This document maps API definitions (Swagger and router definitions) to the moneyhub-api-client methods.
4+
5+
## 1. Request routing
6+
7+
| Config | Backend | Definition source |
8+
|--------|---------|-------------------|
9+
| `resourceServerUrl` | API Gateway (Data API) | api-gateway `swagger.json` (v2), `swagger-v3.json` (v3) |
10+
| `identityServiceUrl` | Identity | identity `swagger.json` |
11+
| `caasResourceServerUrl` | CaaS (Enrichment) | api-gateway `docs-enrichment-engine/swagger-enrichment-engine.json` |
12+
| `osipResourceServerUrl` | OSIP | api-gateway `create-router.js` + `handlers/osip.js` (no Swagger) |
13+
14+
## 2. API Gateway (Data API) – client mapping
15+
16+
**Swagger:** api-gateway `docs/swagger.json` (basePath `/v2.0`), `docs/swagger-v3.json` (basePath `/v3`).
17+
18+
| Path / area | Client method(s) | Module | Notes |
19+
|-------------|------------------|--------|--------|
20+
| GET /accounts | getAccounts, getAccountsWithDetails | accounts | |
21+
| GET /accounts-list | getAccountsList, getAccountsListWithDetails | accounts | **v2 only** – not in v3 Swagger |
22+
| GET/POST/PATCH/DELETE /accounts, /accounts/{id}, /balances | getAccount, getAccountWithDetails, getAccountBalances, createAccount, updateAccount, deleteAccount, addAccountBalance | accounts | |
23+
| Holdings, counterparties, recurring-transactions, standing-orders, statements | getAccountHoldings, getAccountHoldingsWithMatches, getAccountHolding, getAccountCounterparties, getAccountRecurringTransactions, getAccountStandingOrders, getAccountStandingOrdersWithDetail, getAccountStatements, getAccountStatementsWithDetail | accounts | **v2 only:** /accounts-list, /accounts/{id}/counterparties, /accounts/{id}/recurring-transactions (no v3 path) |
24+
| Affordability | (affordability module) | affordability | |
25+
| Beneficiaries | getBeneficiary, getBeneficiaryWithDetail, getBeneficiaries, getBeneficiariesWithDetail | beneficiaries | |
26+
| GET /global-counterparties | getGlobalCounterparties | unauthenticated | |
27+
| Transactions, files, splits | getTransactions, getTransaction, getUnenrichedTransactions, getUnenrichedTransaction, addTransaction, addTransactions, getTransactionFiles, getTransactionFile, addFileToTransaction, deleteTransactionFile, getTransactionSplits, splitTransaction, patchTransactionSplit, deleteTransactionSplits | transactions, transaction-files, transaction-splits | |
28+
| Categories, category-groups | getCategories, getCategory, getCategoryGroups, getStandardCategories, getStandardCategoryGroups, createCustomCategory, updateCategory, deleteCategory | categories | |
29+
| Categorise, regular-transactions | categoriseTransactions, getRegularTransactions, addRegularTransaction, updateRegularTransaction, deleteRegularTransaction, detectRegularTransactions | categorise-transactions, regular-transactions | |
30+
| Rental records | (rental-records module) | rental-records | |
31+
| Spending analysis, spending/savings goals | getSpendingAnalysis, getSpendingGoals, getSpendingGoal, addSpendingGoal, updateSpendingGoal, deleteSpendingGoal, getSavingsGoals, getSavingsGoal, addSavingsGoal, updateSavingsGoal, deleteSavingsGoal | spending-analysis, spending-goals, savings-goals | |
32+
| **GET /standard-financial-statements**, **GET /standard-financial-statements/{reportId}** | **getStandardFinancialStatements**, **getStandardFinancialStatement** | **standard-financial-statements** | **Added in this plan** |
33+
| Sync, projects, tax | syncUserConnection, getProjects, getProject, addProject, updateProject, deleteProject, getTaxReturn | sync, projects, tax | |
34+
| Notification thresholds | getNotificationThresholds, addNotificationThreshold, getNotificationThreshold, updateNotificationThreshold, deleteNotificationThreshold | notification-thresholds | |
35+
36+
## 3. Identity – client mapping
37+
38+
**Swagger:** identity `docs/swagger.json`.
39+
40+
| Path / area | Client method(s) | Module | Notes |
41+
|-------------|------------------|--------|--------|
42+
| GET .well-known/all-connections | listConnections | unauthenticated | |
43+
| GET .well-known/api-connections | listAPIConnections | unauthenticated | |
44+
| GET .well-known/legacy-connections | listLegacyConnections | unauthenticated | **Added in this plan** |
45+
| GET .well-known/test-connections | listTestConnections | unauthenticated | |
46+
| GET .well-known/payments-connections | listPaymentsConnections | unauthenticated | |
47+
| GET .well-known/beta-connections | listBetaConnections | unauthenticated | |
48+
| GET .well-known/openid-configuration | getOpenIdConfig | unauthenticated | |
49+
| Auth-requests, OIDC | createAuthRequest, getAuthRequest, getAllAuthRequests, completeAuthRequest, getAuthUrls, token helpers | auth-requests, get-auth-urls, tokens | |
50+
| Users, connections, syncs, SCIM | getUser, getUsers, registerUser, deleteUser, getUserConnections, deleteUserConnection, updateUserConnection, getConnectionSyncs, getUserSyncs, getSync, getSCIMUser, registerSCIMUser, searchSCIMUsers | users-and-connections | |
51+
| Payees, pay-links, payments | addPayee, getPayees, getPayee, getPayment, getPayments, getPaymentFromIDToken, addPayLink, getPayLink, getPayLinks | payees, pay-links, payments | |
52+
| Standing orders, recurring payments | getStandingOrder, getStandingOrders, getRecurringPayments, getRecurringPayment, makeRecurringPayment, revokeRecurringPayment, confirmFundsForRecurringPayment | standing-orders, recurring-payments | |
53+
| Reseller-check, consent-history | createResellerCheckRequest, getConsentHistory | reseller-check, consent-history | |
54+
| **Pay-file** ||| **Client missing** |
55+
| **Pay-file-consent** ||| **Client missing** |
56+
| **GET /bank-icons/{bankRef}** ||| **Client missing** |
57+
| **GET /consents/{authRequestId}** ||| **Client missing** |
58+
59+
## 4. CaaS (Enrichment API) – client mapping
60+
61+
**Swagger:** api-gateway `docs/docs-enrichment-engine/swagger-enrichment-engine.json` (basePath `/caas/v1`).
62+
63+
| Path / area | Client method(s) | Module | Notes |
64+
|-------------|------------------|--------|--------|
65+
| DELETE /users/{userId} | caasDeleteUser | caas/users | |
66+
| DELETE /accounts/{accountId} | caasDeleteAccount | caas/accounts | |
67+
| GET /categories, /category-groups | caasGetCategories, caasGetCategoryGroups | caas/categories | |
68+
| GET /counterparties | caasGetCounterparties | caas/counterparties | |
69+
| GET /geotags | caasGetGeotags | caas/geotags | |
70+
| GET/PATCH/DELETE /accounts/{accountId}/transactions/{transactionId} | caasGetTransactions, caasPatchTransaction, caasDeleteTransaction | caas/transactions | |
71+
| POST /transactions/enrich | caasEnrichTransactions | caas/transactions | |
72+
| **Custom categories** (users/{userId}/custom-categories) ||| **Client missing** |
73+
| **Account regular-transactions** ||| **Client missing** |
74+
| **Transaction enhanced, splits** ||| **Client missing** |
75+
76+
## 5. OSIP – client mapping
77+
78+
**Definition:** api-gateway `src/api/create-router.js` and `src/api/handlers/osip.js` (no Swagger).
79+
80+
| Method + path | Client method | Module |
81+
|---------------|---------------|--------|
82+
| GET /osip/v1.0/accounts | getOsipAccounts | osip |
83+
| GET /osip/v1.0/accounts/:id | getOsipAccount | osip |
84+
| GET /osip/v1.0/accounts/:id/holdings | getOsipAccountHoldings | osip |
85+
| GET /osip/v1.0/accounts/:id/transactions | getOsipAccountTransactions | osip |
86+
87+
All require `osip:read` scope. Client fully covers these routes.
88+
89+
## 6. Integration test files
90+
91+
| Area | Test file(s) |
92+
|------|--------------|
93+
| Data API (accounts, transactions, etc.) | accounts.ts, accounts-with-extra-options.ts, transactions.ts, categories.ts, tax.ts, beneficiaries.ts, spending-analysis.ts, sync.ts, projects.ts, notification-thresholds.ts, regular-transactions.ts, rental-records.ts, savings-goals.ts, spending-goals.ts, transaction-files.ts, transaction-splits.ts, categorise-transactions.ts |
94+
| Identity | auth-requests.ts, auth-urls.ts, payees.ts, pay-links.ts, payments.ts, standing-orders.ts, recurring-payments.ts, consent-history.ts, reseller-check.ts, users (via index) |
95+
| Unauthenticated / connections | (listConnections etc. exercised via index or auth-urls) |
96+
| CaaS | (optional; depends on env) |
97+
| OSIP | osip.ts |
98+
| Standard financial statements | standard-financial-statements.ts |
99+
100+
**Running tests and coverage**
101+
102+
- **Unit only** (no API config): `npm run test:coverage` — runs `*.unit.ts`, enforces 90% coverage.
103+
- **Full suite** (unit + integration, requires config): `npm run test:integration:coverage` — runs all tests with hooks, enforces 90% line/function/branch/statement coverage.
104+
- Integration tests live in `src/__tests__/*.ts` (non-`.unit.ts`); hooks in `test/hooks.js` provide `this.config` (e.g. `testUserId`, `testAccountId`).

0 commit comments

Comments
 (0)