fix: bug in api path existence test

It was only checking for the path, but not ensuring that the method was also defined
This commit is contained in:
Julian Lam
2020-12-22 10:26:02 -05:00
parent 1cd2689cf6
commit 501a7b7774

View File

@@ -235,7 +235,8 @@ describe('API', async () => {
}
const normalizedPath = pathObj.path.replace(/\/:([^\\/]+)/g, '/{$1}').replace(/\?/g, '');
assert(schema.paths.hasOwnProperty(normalizedPath));
assert(schema.paths.hasOwnProperty(normalizedPath), `${pathObj.path} is not defined in schema docs`);
assert(schema.paths[normalizedPath].hasOwnProperty(pathObj.method), `${pathObj.path} was found in schema docs, but ${pathObj.method.toUpperCase()} method is not defined`);
});
});
});