Node.js based forum software built for the modern web
fix: missing await
Barış Soner Uşaklı97c086aba9ee
diff --git a/src/categories/index.js b/src/categories/index.jsindex 03db4f68c5..371f71a579 100644--- a/src/categories/index.js+++ b/src/categories/index.js@@ -236,7 +236,7 @@ Categories.getChildrenCids = async function (rootCid) {}keys = childrenCids.map(cid => 'cid:' + cid + ':children');childrenCids.forEach(cid => allCids.push(parseInt(cid, 10)));- recursive(keys);+ await recursive(keys);}const key = 'cid:' + rootCid + ':children';const childrenCids = cache.get(key);diff --git a/test/categories.js b/test/categories.jsindex 82cf43acf1..242abd9294 100644--- a/test/categories.js+++ b/test/categories.js@@ -910,4 +910,18 @@ describe('Categories', function () {});});});++ it('should return nested children categories', async function () {+ const rootCategory = await Categories.create({ name: 'root' });+ const child1 = await Categories.create({ name: 'child1', parentCid: rootCategory.cid });+ const child2 = await Categories.create({ name: 'child2', parentCid: child1.cid });+ const data = await Categories.getCategoryById({+ uid: 1,+ cid: rootCategory.cid,+ start: 0,+ stop: 19,+ });+ assert.strictEqual(child1.cid, data.children[0].cid);+ assert.strictEqual(child2.cid, data.children[0].children[0].cid);+ });});