fix: api tests

This commit is contained in:
Julian Lam
2020-12-17 14:17:01 -05:00
parent 600807fbe1
commit b9a61d2d45
2 changed files with 2 additions and 2 deletions

View File

@@ -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:

View File

@@ -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`);
}); });