diff --git a/src/custom-sort/custom-sort.spec.ts b/src/custom-sort/custom-sort.spec.ts index d42696d..b6a6133 100644 --- a/src/custom-sort/custom-sort.spec.ts +++ b/src/custom-sort/custom-sort.spec.ts @@ -2261,25 +2261,6 @@ describe('CustomSortOrder.byMetadataFieldAlphabeticalReverse', () => { expect(result2).toBe(SORT_FIRST_GOES_LATER) expect(result3).toBe(SORT_ITEMS_ARE_EQUAL) }) - it('should put the item with metadata below the second one w/o metadata (this is reverse order)', () => { - // given - const itemA: Partial = { - metadataFieldValue: '15', - sortString: 'n123' - } - const itemB: Partial = { - sortString: 'n123' - } - const sorter: SorterFn = getSorterFnFor(CustomSortOrder.byMetadataFieldAlphabetical) - - // when - const result1: number = sorter(itemA as FolderItemForSorting, itemB as FolderItemForSorting) - const result2: number = sorter(itemB as FolderItemForSorting, itemA as FolderItemForSorting) - - // then - expect(result1).toBe(SORT_FIRST_GOES_LATER) - expect(result2).toBe(SORT_FIRST_GOES_EARLIER) - }) it('should put the item with metadata later if the second one has no metadata (reverse order)', () => { // given const itemA: Partial = { diff --git a/src/custom-sort/custom-sort.ts b/src/custom-sort/custom-sort.ts index afbe76e..64eb919 100644 --- a/src/custom-sort/custom-sort.ts +++ b/src/custom-sort/custom-sort.ts @@ -42,6 +42,15 @@ export interface ProcessingContext { iconFolderPluginInstance?: ObsidianIconFolder_PluginInstance } +export interface ProcessingContext { + // For internal transient use + plugin?: Plugin // to hand over the access to App instance to the sorting engine + _mCache?: MetadataCache + starredPluginInstance?: Starred_PluginInstance + + iconFolderPluginInstance?: ObsidianIconFolder_PluginInstance +} + let CollatorCompare = new Intl.Collator(undefined, { usage: "sort", sensitivity: "base",