Bugfix in sorterByMetadataField - reverse order working correctly now

- fix in unit tests
This commit is contained in:
SebastianMC 2023-08-24 00:35:19 +02:00
parent f48bc4d11f
commit 24355ff0a4
1 changed files with 3 additions and 3 deletions

View File

@ -2235,7 +2235,7 @@ describe('CustomSortOrder.byMetadataFieldAlphabeticalReverse', () => {
expect(result2).toBe(SORT_FIRST_GOES_LATER) expect(result2).toBe(SORT_FIRST_GOES_LATER)
expect(result3).toBe(SORT_ITEMS_ARE_EQUAL) expect(result3).toBe(SORT_ITEMS_ARE_EQUAL)
}) })
it('should put the item with metadata earlier if the second one has no metadata ', () => { it('should put the item with metadata below the second one w/o metadata (this is reverse order)', () => {
// given // given
const itemA: Partial<FolderItemForSorting> = { const itemA: Partial<FolderItemForSorting> = {
metadataFieldValue: '15', metadataFieldValue: '15',
@ -2251,8 +2251,8 @@ describe('CustomSortOrder.byMetadataFieldAlphabeticalReverse', () => {
const result2: number = sorter(itemB as FolderItemForSorting, itemA as FolderItemForSorting) const result2: number = sorter(itemB as FolderItemForSorting, itemA as FolderItemForSorting)
// then // then
expect(result1).toBe(SORT_FIRST_GOES_EARLIER) expect(result1).toBe(SORT_FIRST_GOES_LATER)
expect(result2).toBe(SORT_FIRST_GOES_LATER) expect(result2).toBe(SORT_FIRST_GOES_EARLIER)
}) })
it('should correctly fallback to alphabetical reverse if no metadata on both items', () => { it('should correctly fallback to alphabetical reverse if no metadata on both items', () => {
// given // given