diff --git a/src/backend/model/database/SearchManager.ts b/src/backend/model/database/SearchManager.ts index 6079940f..48755562 100644 --- a/src/backend/model/database/SearchManager.ts +++ b/src/backend/model/database/SearchManager.ts @@ -356,7 +356,7 @@ export class SearchManager { if (!sortings || !Array.isArray(sortings)) { return query; } - if (sortings.includes(SortingMethods.random) && sortings.length > 0) { + if (sortings.includes(SortingMethods.random) && sortings.length > 1) { throw new Error('Error during applying sorting: Can\' randomize and also sort the result. Bad input:' + sortings.map(s => SortingMethods[s]).join(', ')); } for (const sort of sortings) { diff --git a/test/backend/integration/routers/admin/SettingsRouter.ts b/test/backend/integration/routers/admin/SettingsRouter.ts index 649e5e7d..36663cf0 100644 --- a/test/backend/integration/routers/admin/SettingsRouter.ts +++ b/test/backend/integration/routers/admin/SettingsRouter.ts @@ -46,7 +46,9 @@ describe('SettingsRouter', () => { result.body.should.be.a('object'); should.equal(result.body.error, null); (result.body.result as ServerConfig).Environment.upTime = null; + (result.body.result as ServerConfig).Environment.sendMailAvailable = null; originalSettings.Environment.upTime = null; + originalSettings.Environment.sendMailAvailable = null; result.body.result.should.deep.equal(JSON.parse(JSON.stringify(originalSettings.toJSON({ attachState: true, attachVolatile: true, diff --git a/test/backend/unit/model/sql/SearchManager.spec.ts b/test/backend/unit/model/sql/SearchManager.spec.ts index a1b8f92d..3837aaee 100644 --- a/test/backend/unit/model/sql/SearchManager.spec.ts +++ b/test/backend/unit/model/sql/SearchManager.spec.ts @@ -1406,14 +1406,14 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => { } as TextSearch; // eslint-disable-next-line - expect(await sm.getNMedia(query, [SortingMethods.random], 1, true)).to.not.exist; + expect(await sm.getNMedia(query, [SortingMethods.random], 1, true)).to.deep.equalInAnyOrder([]); query = ({ text: 'wookiees', matchType: TextSearchQueryMatchTypes.exact_match, type: SearchQueryTypes.keyword } as TextSearch); - expect(Utils.clone(await sm.getNMedia(query, [SortingMethods.random], 1, true))).to.deep.equalInAnyOrder(searchifyMedia(pFaceLess)); + expect(Utils.clone(await sm.getNMedia(query, [SortingMethods.random], 1, true))).to.deep.equalInAnyOrder([searchifyMedia(pFaceLess)]); }); });