mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 00:10:25 +01:00
Testing suite integration for openapi spec (#8263)
* feat: testing suite integration for openapi spec The testing suite now takes the openapi spec into account. It will check each route defined, make a call to it, and compare the response with the defined schema. Any mismatches will cause the test to fail. * fix(openapi): removed debug stuff from tests * fix(openapi): fixed some tests * fix(openapi): added additional check to tests, test fixes * fix(openapi): better tests, fixed spec errors * fix(openapi): bad conditional in test * fix: oops * fix(openapi): more tests fixing * fix(openapi): more tests * fix(openapi): fix some more tests * fix: verbose'd an info log * fix: topic pagination route returns schema-optimized pagination block * fix(openapi): more test/spec fixes * fix(openapi): accidentally sending in authenticated jar for anon routes * fix(openapi): more test/spec fixes * fix(openapi): more spec fixes * fix: timestampReadable Invalid Date * fix(openapi): more tests... almost there * fix(openapi): more tests fixing * fix(openapi): finally all tests passing * fix(openapi): added reverse test to compare response to spec ... and fixed all the tests that broke * fix: remove tests related to group covers, as route is gone * fix(openapi): broken test on travis * fix(openapi): broken test on travis * fix(openapi): broken test on travis * fix(openapi): object cache is not present for psql * fix: tests Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
This commit is contained in:
@@ -70,16 +70,12 @@ topicsController.get = async function getTopic(req, res, callback) {
|
||||
topics.modifyPostsByPrivilege(topicData, userPrivileges);
|
||||
|
||||
const hookData = await plugins.fireHook('filter:controllers.topic.get', { topicData: topicData, uid: req.uid });
|
||||
await Promise.all([
|
||||
buildBreadcrumbs(hookData.topicData),
|
||||
addTags(topicData, req, res),
|
||||
]);
|
||||
|
||||
topicData.privileges = userPrivileges;
|
||||
topicData.topicStaleDays = meta.config.topicStaleDays;
|
||||
topicData['reputation:disabled'] = meta.config['reputation:disabled'];
|
||||
topicData['downvote:disabled'] = meta.config['downvote:disabled'];
|
||||
topicData['feeds:disableRSS'] = meta.config['feeds:disableRSS'];
|
||||
topicData['feeds:disableRSS'] = meta.config['feeds:disableRSS'] || 0;
|
||||
topicData.bookmarkThreshold = meta.config.bookmarkThreshold;
|
||||
topicData.necroThreshold = meta.config.necroThreshold;
|
||||
topicData.postEditDuration = meta.config.postEditDuration;
|
||||
@@ -99,6 +95,11 @@ topicsController.get = async function getTopic(req, res, callback) {
|
||||
res.locals.linkTags.push(rel);
|
||||
});
|
||||
|
||||
await Promise.all([
|
||||
buildBreadcrumbs(hookData.topicData),
|
||||
addTags(topicData, req, res),
|
||||
]);
|
||||
|
||||
incrementViewCount(req, tid);
|
||||
|
||||
markAsRead(req, tid);
|
||||
@@ -338,5 +339,5 @@ topicsController.pagination = async function (req, res, callback) {
|
||||
rel.href = nconf.get('url') + '/topic/' + topic.slug + rel.href;
|
||||
});
|
||||
|
||||
res.json(paginationData);
|
||||
res.json({ pagination: paginationData });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user