fix: api tests

v1.18.x
Julian Lam 4 years ago
parent 600807fbe1
commit b9a61d2d45

@ -8,7 +8,7 @@ get:
For example, to go to `uid` 15's list of topics made, you can navigate to `/api/uid/15/topics`, which will send you to the appropriate canonical URL for that user's topics. For example, to go to `uid` 15's list of topics made, you can navigate to `/api/uid/15/topics`, which will send you to the appropriate canonical URL for that user's topics.
parameters: parameters:
- name: uid - name: uid*
in: path in: path
required: true required: true
schema: schema:

@ -246,7 +246,7 @@ describe('API', async () => {
return; return;
} }
const names = (path.match(/{[\w\-_]+}?/g) || []).map(match => match.slice(1, -1)); const names = (path.match(/{[\w\-_*]+}?/g) || []).map(match => match.slice(1, -1));
assert(context[method].parameters.map(param => (param.in === 'path' ? param.name : null)).filter(Boolean).every(name => names.includes(name)), `${method.toUpperCase()} ${path} has parameter(s) in path that are not defined in schema`); assert(context[method].parameters.map(param => (param.in === 'path' ? param.name : null)).filter(Boolean).every(name => names.includes(name)), `${method.toUpperCase()} ${path} has parameter(s) in path that are not defined in schema`);
}); });

Loading…
Cancel
Save