From bbaaead09c5e3c852d243b113724d2048e1c175a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 17 Feb 2021 13:03:14 -0500 Subject: [PATCH] feat: add category search test, #9307 --- test/search.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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',