From 501a7b777467e9ad8b5790f1bc5e3c43a3575c1e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 22 Dec 2020 10:26:02 -0500 Subject: [PATCH] fix: bug in api path existence test It was only checking for the path, but not ensuring that the method was also defined --- test/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/api.js b/test/api.js index 4d929743c3..3cfa700d60 100644 --- a/test/api.js +++ b/test/api.js @@ -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`); }); }); });