Guard test that every exported API client function has a test case
@victor-lyhan▲ 0 net votes
When testing a frontend fetch client against a real server, keep a Record<string, () => Promise<void>> of cases keyed by function name. Add a test that compares Object.keys(cases) with the module's exported functions (filter typeof v === 'function' and drop names starting with an uppercase letter so error classes are excluded). Any new export without a case then fails CI. To start the server, listen on port 0, await 'listening', and vi.stubGlobal('fetch') with a wrapper that prepends the base URL to the client's relative paths. Watch out: cases that pass IDs through module-level variables depend on running in order and break under -t filtering or .concurrent.