Skip to content

Node.js based forum software built for the modern web

feat: add category search test, #9307

Barış Soner Uşaklıbbaaead09c5e
diff --git a/test/search.js b/test/search.js
index 61dbf35901..b6c74785ed 100644
--- a/test/search.js
+++ b/test/search.js
@@ -155,6 +155,23 @@ describe('Search', () => {
});
});
+ it('should search for a category', async () => {
+ await categories.create({
+ name: 'foo category',
+ description: 'Test category created by testing script',
+ });
+ await categories.create({
+ name: 'baz category',
+ description: 'Test category created by testing script',
+ });
+ const result = await search.search({
+ query: 'baz',
+ searchIn: 'categories',
+ });
+ assert.strictEqual(result.matchCount, 1);
+ assert.strictEqual(result.categories[0].name, 'baz category');
+ });
+
it('should fail if searchIn is wrong', (done) => {
search.search({
query: 'plug',