1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fix random photo tests #683

This commit is contained in:
Patrik J. Braun 2023-07-30 12:27:29 +02:00
parent 763e982d2d
commit 015a0221c2

View File

@ -35,6 +35,7 @@ import {AutoCompleteItem} from '../../../../../src/common/entities/AutoCompleteI
import {Config} from '../../../../../src/common/config/private/Config'; import {Config} from '../../../../../src/common/config/private/Config';
import {SearchQueryParser} from '../../../../../src/common/SearchQueryParser'; import {SearchQueryParser} from '../../../../../src/common/SearchQueryParser';
import {FileDTO} from '../../../../../src/common/entities/FileDTO'; import {FileDTO} from '../../../../../src/common/entities/FileDTO';
import {SortingMethods} from '../../../../../src/common/entities/SortingMethods';
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const deepEqualInAnyOrder = require('deep-equal-in-any-order'); const deepEqualInAnyOrder = require('deep-equal-in-any-order');
@ -1405,14 +1406,14 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
} as TextSearch; } as TextSearch;
// eslint-disable-next-line // eslint-disable-next-line
expect(await sm.getRandomPhoto(query)).to.not.exist; expect(await sm.getNMedia(query, [SortingMethods.random], 1, true)).to.not.exist;
query = ({ query = ({
text: 'wookiees', text: 'wookiees',
matchType: TextSearchQueryMatchTypes.exact_match, matchType: TextSearchQueryMatchTypes.exact_match,
type: SearchQueryTypes.keyword type: SearchQueryTypes.keyword
} as TextSearch); } as TextSearch);
expect(Utils.clone(await sm.getRandomPhoto(query))).to.deep.equalInAnyOrder(searchifyMedia(pFaceLess)); expect(Utils.clone(await sm.getNMedia(query, [SortingMethods.random], 1, true))).to.deep.equalInAnyOrder(searchifyMedia(pFaceLess));
}); });
}); });