mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 05:56:34 +02:00
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:
@@ -235,7 +235,8 @@ describe('API', async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const normalizedPath = pathObj.path.replace(/\/:([^\\/]+)/g, '/{$1}').replace(/\?/g, '');
|
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`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user