Major refactoring of sorting structures. Unit tests updated, compiling.
This commit is contained in:
parent
eeb581120d
commit
c63b83d596
|
@ -29,7 +29,7 @@ describe('determineFolderDatesIfNeeded', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.alphabetical
|
||||
sorting: { order: CustomSortOrder.alphabetical }
|
||||
}],
|
||||
outsidersGroupIdx: OUTSIDERS_GROUP_IDX
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ describe('determineFolderDatesIfNeeded', () => {
|
|||
const OUTSIDERS_GROUP_IDX = 0
|
||||
const sortSpec: CustomSortSpec = {
|
||||
targetFoldersPaths: ['/'],
|
||||
defaultOrder: folderOrder,
|
||||
defaultSorting: folderOrder ? { order: folderOrder } : undefined,
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: order
|
||||
sorting: { order: order }
|
||||
}],
|
||||
outsidersGroupIdx: OUTSIDERS_GROUP_IDX
|
||||
}
|
||||
|
@ -90,10 +90,10 @@ describe('determineFolderDatesIfNeeded', () => {
|
|||
const OUTSIDERS_GROUP_IDX = 0
|
||||
const sortSpec: CustomSortSpec = {
|
||||
targetFoldersPaths: ['/'],
|
||||
defaultOrder: folderOrder,
|
||||
defaultSorting: folderOrder ? { order: folderOrder} : undefined,
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: order
|
||||
sorting: { order: order }
|
||||
}],
|
||||
outsidersGroupIdx: OUTSIDERS_GROUP_IDX
|
||||
}
|
||||
|
|
|
@ -14,18 +14,18 @@ const FlatLevelSortSpec: CustomSortSpec = {
|
|||
groups: [{ // Not relevant in unit test
|
||||
exactText: "Nothing",
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{ // prepared for unit test
|
||||
exactPrefix: "Fi",
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
},{ // Not relevant in unit test
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.byCreatedTime
|
||||
sorting: { order: CustomSortOrder.byCreatedTime },
|
||||
}],
|
||||
outsidersGroupIdx: 2,
|
||||
defaultOrder: CustomSortOrder.byCreatedTime,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
targetFoldersPaths: ['parent folder']
|
||||
}
|
||||
|
||||
|
@ -33,19 +33,19 @@ const MultiLevelSortSpecGroupLevel: CustomSortSpec = {
|
|||
groups: [{ // Not relevant in unit test
|
||||
exactText: "Nothing",
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{ // prepared for unit test
|
||||
exactPrefix: "Fi",
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
},{ // Not relevant in unit test
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.byCreatedTime
|
||||
sorting: { order: CustomSortOrder.byCreatedTime },
|
||||
}],
|
||||
outsidersGroupIdx: 2,
|
||||
defaultOrder: CustomSortOrder.byCreatedTime,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
targetFoldersPaths: ['parent folder']
|
||||
}
|
||||
|
||||
|
@ -53,19 +53,19 @@ const MultiLevelSortSpecTargetFolderLevel: CustomSortSpec = {
|
|||
groups: [{ // Not relevant in unit test
|
||||
exactText: "Nothing",
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{ // prepared for unit test
|
||||
exactPrefix: "Fi",
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
},{ // Not relevant in unit test
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.byCreatedTime
|
||||
sorting: { order: CustomSortOrder.byCreatedTime },
|
||||
}],
|
||||
outsidersGroupIdx: 2,
|
||||
defaultOrder: CustomSortOrder.byCreatedTime,
|
||||
defaultSecondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse, },
|
||||
targetFoldersPaths: ['parent folder']
|
||||
}
|
||||
|
||||
|
@ -73,20 +73,20 @@ const MultiLevelSortSpecAndTargetFolderLevel: CustomSortSpec = {
|
|||
groups: [{ // Not relevant in unit test
|
||||
exactText: "Nothing",
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{ // prepared for unit test
|
||||
exactPrefix: "Fi",
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
},{ // Not relevant in unit test
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.byCreatedTime
|
||||
sorting: { order: CustomSortOrder.byCreatedTime },
|
||||
}],
|
||||
outsidersGroupIdx: 2,
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
defaultSecondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse, },
|
||||
targetFoldersPaths: ['parent folder']
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ describe('hasOnlyByBookmarkOrStandardObsidian and collectSortingAndGroupingTypes
|
|||
})
|
||||
it('should detect not matching default order', () => {
|
||||
const spec: Partial<CustomSortSpec>|undefined = {
|
||||
defaultOrder: CustomSortOrder.default,
|
||||
defaultSorting: { order: CustomSortOrder.default },
|
||||
groups: [
|
||||
{
|
||||
type: CustomSortGroupType.ExactName,
|
||||
|
@ -80,8 +80,8 @@ describe('hasOnlyByBookmarkOrStandardObsidian and collectSortingAndGroupingTypes
|
|||
})
|
||||
it('should detect not matching default secondary order', () => {
|
||||
const spec: Partial<CustomSortSpec>|undefined = {
|
||||
defaultOrder: CustomSortOrder.byBookmarkOrder,
|
||||
defaultSecondaryOrder: CustomSortOrder.default,
|
||||
defaultSorting: { order: CustomSortOrder.byBookmarkOrder },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.default },
|
||||
groups: [
|
||||
{
|
||||
type: CustomSortGroupType.BookmarkedOnly,
|
||||
|
@ -99,12 +99,12 @@ describe('hasOnlyByBookmarkOrStandardObsidian and collectSortingAndGroupingTypes
|
|||
})
|
||||
it('should detect not matching order in group', () => {
|
||||
const spec: Partial<CustomSortSpec>|undefined = {
|
||||
defaultOrder: CustomSortOrder.byBookmarkOrder,
|
||||
defaultSecondaryOrder: CustomSortOrder.standardObsidian,
|
||||
defaultSorting: { order: CustomSortOrder.byBookmarkOrder },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.standardObsidian },
|
||||
groups: [
|
||||
{
|
||||
type: CustomSortGroupType.ExactName,
|
||||
order: CustomSortOrder.byCreatedTimeReverse
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeReverse }
|
||||
},
|
||||
{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
|
@ -119,18 +119,18 @@ describe('hasOnlyByBookmarkOrStandardObsidian and collectSortingAndGroupingTypes
|
|||
})
|
||||
it('should detect not matching secondary order in group', () => {
|
||||
const spec: Partial<CustomSortSpec>|undefined = {
|
||||
defaultOrder: CustomSortOrder.byBookmarkOrder,
|
||||
defaultSecondaryOrder: CustomSortOrder.standardObsidian,
|
||||
defaultSorting: { order: CustomSortOrder.byBookmarkOrder },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.standardObsidian },
|
||||
groups: [
|
||||
{
|
||||
type: CustomSortGroupType.ExactName,
|
||||
order: CustomSortOrder.byBookmarkOrderReverse,
|
||||
secondaryOrder: CustomSortOrder.standardObsidian
|
||||
sorting: { order: CustomSortOrder.byBookmarkOrderReverse },
|
||||
secondarySorting: { order: CustomSortOrder.standardObsidian }
|
||||
},
|
||||
{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.byBookmarkOrder,
|
||||
secondaryOrder: CustomSortOrder.alphabetical
|
||||
sorting: { order: CustomSortOrder.byBookmarkOrder },
|
||||
secondarySorting: { order: CustomSortOrder.alphabetical }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -142,18 +142,18 @@ describe('hasOnlyByBookmarkOrStandardObsidian and collectSortingAndGroupingTypes
|
|||
})
|
||||
it('should detect matching orders at all levels', () => {
|
||||
const spec: Partial<CustomSortSpec>|undefined = {
|
||||
defaultOrder: CustomSortOrder.byBookmarkOrder,
|
||||
defaultSecondaryOrder: CustomSortOrder.standardObsidian,
|
||||
defaultSorting: { order: CustomSortOrder.byBookmarkOrder },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.standardObsidian },
|
||||
groups: [
|
||||
{
|
||||
type: CustomSortGroupType.BookmarkedOnly,
|
||||
order: CustomSortOrder.byBookmarkOrderReverse,
|
||||
secondaryOrder: CustomSortOrder.standardObsidian
|
||||
sorting: { order: CustomSortOrder.byBookmarkOrderReverse },
|
||||
secondarySorting: { order: CustomSortOrder.standardObsidian }
|
||||
},
|
||||
{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.byBookmarkOrder,
|
||||
secondaryOrder: CustomSortOrder.byBookmarkOrderReverse
|
||||
sorting: { order: CustomSortOrder.byBookmarkOrder },
|
||||
secondarySorting: { order: CustomSortOrder.byBookmarkOrderReverse }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1592,9 +1592,10 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataField: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadata: 'metadata-field-for-sorting',
|
||||
},
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1634,9 +1635,9 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataField: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting',},
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1676,9 +1677,9 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataField: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabetical
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadata: 'metadata-field-for-sorting', },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1718,9 +1719,9 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataField: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting', },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1761,8 +1762,8 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
byMetadataField: 'metadata-field-for-sorting',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting', },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1804,10 +1805,11 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical },
|
||||
}],
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadataField: 'metadata-field-for-sorting-specified-on-target-folder'
|
||||
defaultSorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting-specified-on-target-folder'
|
||||
}
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
_mCache: {
|
||||
|
@ -1846,7 +1848,7 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.HasMetadataField,
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical, },
|
||||
withMetadataFieldName: 'field-used-with-with-metadata-syntax'
|
||||
}]
|
||||
}
|
||||
|
@ -1888,7 +1890,7 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1931,10 +1933,10 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataFieldSecondary: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabetical
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadata: 'metadata-field-for-sorting', },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -1974,10 +1976,10 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataFieldSecondary: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting', },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -2017,11 +2019,11 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataField: 'non-existing-mdata',
|
||||
byMetadataFieldSecondary: 'metadata-field-for-sorting',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadata: 'non-existing-mdata'},
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadata: 'metadata-field-for-sorting'},
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -2061,11 +2063,13 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
byMetadataField: 'metadata-field-for-sorting',
|
||||
byMetadataFieldSecondary: 'metadata-field-for-sorting secondary',
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadata: 'metadata-field-for-sorting',
|
||||
},
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting secondary',
|
||||
},
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -2108,9 +2112,10 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
byMetadataFieldSecondary: 'metadata-field-for-sorting',
|
||||
order: CustomSortOrder.standardObsidian,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.standardObsidian,
|
||||
byMetadata: 'metadata-field-for-sorting'
|
||||
},
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -2152,12 +2157,13 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabetical
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabetical },
|
||||
}],
|
||||
defaultOrder: CustomSortOrder.byCreatedTime,
|
||||
defaultSecondaryOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadataFieldSecondary: 'metadata-field-for-sorting-specified-on-target-folder'
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'metadata-field-for-sorting-specified-on-target-folder'
|
||||
},
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
_mCache: {
|
||||
|
@ -2196,8 +2202,8 @@ describe('determineSortingGroup', () => {
|
|||
targetFoldersPaths: ['/'],
|
||||
groups: [{
|
||||
type: CustomSortGroupType.HasMetadataField,
|
||||
order: CustomSortOrder.standardObsidian,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
sorting: { order: CustomSortOrder.standardObsidian, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabetical, },
|
||||
withMetadataFieldName: 'field-used-with-with-metadata-syntax'
|
||||
}]
|
||||
}
|
||||
|
@ -2239,8 +2245,8 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byCreatedTimeReverse,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabetical
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabetical },
|
||||
}]
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
|
@ -2284,15 +2290,19 @@ describe('determineSortingGroup', () => {
|
|||
groups: [{
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Ref',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: 'mdata-for-primary',
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadataFieldSecondary: 'mdata-for-secondary'
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadata: 'mdata-for-primary',
|
||||
},
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'mdata-for-secondary'
|
||||
},
|
||||
}],
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadataField: 'mdata-for-default-primary',
|
||||
defaultSecondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadataFieldSecondary: 'mdata-for-default-secondary'
|
||||
defaultSorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadata: 'mdata-for-default-primary',
|
||||
},
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadata: 'mdata-for-default-secondary'
|
||||
},
|
||||
}
|
||||
const ctx: Partial<ProcessingContext> = {
|
||||
_mCache: {
|
||||
|
@ -2338,24 +2348,24 @@ describe('determineSortingGroup', () => {
|
|||
const sortSpec: CustomSortSpec = {
|
||||
groups: [{
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
exactSuffix: "def!",
|
||||
priority: 2,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactSuffix
|
||||
}, {
|
||||
exactText: "Abcdef!",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
priority: 3,
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
outsidersGroupIdx: 4,
|
||||
|
@ -2384,28 +2394,28 @@ describe('determineSortingGroup', () => {
|
|||
const sortSpec: CustomSortSpec = {
|
||||
groups: [{
|
||||
exactSuffix: "def!",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactSuffix
|
||||
}, {
|
||||
exactPrefix: "Hello :-)",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
combineWithIdx: 1
|
||||
}, {
|
||||
exactText: "Hello World :-)",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactName,
|
||||
combineWithIdx: 1
|
||||
}, {
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
outsidersGroupIdx: 5,
|
||||
|
@ -2442,25 +2452,25 @@ describe('determineSortingGroup', () => {
|
|||
const sortSpec: CustomSortSpec = {
|
||||
groups: [{
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
exactSuffix: "def!",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactSuffix,
|
||||
combineWithIdx: 2
|
||||
}, {
|
||||
exactText: "Hello :-)",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactName,
|
||||
priority: 1,
|
||||
combineWithIdx: 2
|
||||
}, {
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
outsidersGroupIdx: 4,
|
||||
|
|
|
@ -157,7 +157,7 @@ target-folder: Same rules as for References
|
|||
|
||||
const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.alphabetical,
|
||||
defaultSorting: { order: CustomSortOrder.alphabetical, },
|
||||
groups: [{
|
||||
foldersOnly: true,
|
||||
type: CustomSortGroupType.MatchAll
|
||||
|
@ -187,12 +187,14 @@ const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
|||
filesOnly: true,
|
||||
type: CustomSortGroupType.HasMetadataField,
|
||||
withMetadataFieldName: 'sort-index-value',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: 'Some-dedicated-field',
|
||||
sorting: {
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadata: 'Some-dedicated-field',
|
||||
}
|
||||
}, {
|
||||
type: CustomSortGroupType.HasMetadataField,
|
||||
withMetadataFieldName: 'Pages',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse },
|
||||
}, {
|
||||
type: CustomSortGroupType.HasIcon,
|
||||
filesOnly: true
|
||||
|
@ -216,17 +218,17 @@ const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
|||
]
|
||||
},
|
||||
"folder of bookmarks": {
|
||||
defaultOrder: CustomSortOrder.byBookmarkOrder,
|
||||
defaultSorting: { order: CustomSortOrder.byBookmarkOrder, },
|
||||
groups: [
|
||||
{
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.byBookmarkOrder,
|
||||
sorting: { order: CustomSortOrder.byBookmarkOrder, },
|
||||
type: CustomSortGroupType.BookmarkedOnly
|
||||
},
|
||||
{
|
||||
exactText: "Abc",
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byBookmarkOrderReverse,
|
||||
sorting: { order: CustomSortOrder.byBookmarkOrderReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},
|
||||
{
|
||||
|
@ -256,11 +258,11 @@ const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
|||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}, {
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}, {
|
||||
exactPrefix: "Ref",
|
||||
|
@ -286,7 +288,7 @@ const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
|||
targetFoldersPaths: ['/']
|
||||
},
|
||||
"Sandbox": {
|
||||
defaultOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
defaultSorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
groups: [{
|
||||
exactText: "adfsasda",
|
||||
filesOnly: true,
|
||||
|
@ -294,12 +296,12 @@ const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
|||
}, {
|
||||
exactText: "sdsadasdsa",
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "fdsfdsfdsfs",
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byCreatedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
type: CustomSortGroupType.Outsiders
|
||||
|
@ -308,20 +310,20 @@ const expectedSortSpecsExampleA: { [key: string]: CustomSortSpec } = {
|
|||
targetFoldersPaths: ['Sandbox']
|
||||
},
|
||||
"Abcd efgh ijk": {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
groups: [{
|
||||
exactPrefix: "Plain text spec bla bla bla (matches files and folders)",
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
exactText: "files only matching",
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
matchFilenameWithExt: true,
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "folders only matching",
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "some-file (or folder)",
|
||||
|
@ -453,16 +455,20 @@ const txtInputExampleMDataExtractors2: string = `
|
|||
|
||||
const expectedSortSpecsExampleMDataExtractors1: { [key: string]: CustomSortSpec } = {
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: 'created-by',
|
||||
metadataFieldValueExtractor: _unitTests.extractorFnForDate_ddmmyyyy,
|
||||
defaultSorting: {
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadata: 'created-by',
|
||||
metadataValueExtractor: _unitTests.extractorFnForDate_ddmmyyyy
|
||||
},
|
||||
groups: [{
|
||||
foldersOnly: true,
|
||||
type: CustomSortGroupType.ExactPrefix,
|
||||
exactPrefix: 'Chapter',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadataField: 'updated-on',
|
||||
metadataFieldValueExtractor: _unitTests.extractorFnForDate_mmddyyyy
|
||||
sorting: {
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'updated-on',
|
||||
metadataValueExtractor: _unitTests.extractorFnForDate_mmddyyyy
|
||||
}
|
||||
}, {
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -473,22 +479,30 @@ const expectedSortSpecsExampleMDataExtractors1: { [key: string]: CustomSortSpec
|
|||
|
||||
const expectedSortSpecsExampleMDataExtractors2: { [key: string]: CustomSortSpec } = {
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: 'created by',
|
||||
metadataFieldValueExtractor: _unitTests.extractorFnForDate_mmddyyyy,
|
||||
defaultSecondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadataFieldSecondary: '',
|
||||
metadataFieldSecondaryValueExtractor: _unitTests.extractorFnForDate_ddmmyyyy,
|
||||
defaultSorting: {
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadata: 'created by',
|
||||
metadataValueExtractor: _unitTests.extractorFnForDate_mmddyyyy
|
||||
},
|
||||
defaultSecondarySorting: {
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
byMetadata: '',
|
||||
metadataValueExtractor: _unitTests.extractorFnForDate_ddmmyyyy
|
||||
},
|
||||
groups: [{
|
||||
foldersOnly: true,
|
||||
type: CustomSortGroupType.ExactSuffix,
|
||||
exactSuffix: 'Chapter',
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadataField: 'updated-on',
|
||||
metadataFieldValueExtractor: _unitTests.extractorFnForDate_ddmmyyyy,
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadataFieldSecondary: 'md2',
|
||||
metadataFieldSecondaryValueExtractor: _unitTests.extractorFnForDate_mmddyyyy
|
||||
sorting: {
|
||||
order: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
byMetadata: 'updated-on',
|
||||
metadataValueExtractor: _unitTests.extractorFnForDate_ddmmyyyy
|
||||
},
|
||||
secondarySorting: {
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadata: 'md2',
|
||||
metadataValueExtractor: _unitTests.extractorFnForDate_mmddyyyy
|
||||
}
|
||||
}, {
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -538,7 +552,7 @@ target-folder: BBB
|
|||
|
||||
const expectedSortSpecsNotDuplicatedSortSpec: { [key: string]: CustomSortSpec } = {
|
||||
"AAA": {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -578,11 +592,11 @@ sorting: standard
|
|||
|
||||
const expectedSortSpecForObsidianStandardSorting: { [key: string]: CustomSortSpec } = {
|
||||
"AAA": {
|
||||
defaultOrder: CustomSortOrder.standardObsidian,
|
||||
defaultSorting: { order: CustomSortOrder.standardObsidian, },
|
||||
groups: [{
|
||||
exactText: 'Some folder',
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.standardObsidian,
|
||||
sorting: { order: CustomSortOrder.standardObsidian, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
type: CustomSortGroupType.Outsiders
|
||||
|
@ -615,17 +629,17 @@ subitems2...
|
|||
|
||||
const expectedSortSpecForFilesOrFoldersPreferred: { [key: string]: CustomSortSpec } = {
|
||||
"AAA": {
|
||||
defaultOrder: CustomSortOrder.alphabetical,
|
||||
defaultSecondaryOrder: CustomSortOrder.fileFirst,
|
||||
defaultSorting: { order: CustomSortOrder.alphabetical, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.fileFirst, },
|
||||
groups: [{
|
||||
exactPrefix: 'subitems1',
|
||||
order: CustomSortOrder.folderFirst,
|
||||
secondaryOrder: CustomSortOrder.trueAlphabeticalWithFileExt,
|
||||
sorting: { order: CustomSortOrder.folderFirst, },
|
||||
secondarySorting: { order: CustomSortOrder.trueAlphabeticalWithFileExt, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
},{
|
||||
exactPrefix: 'subitems2',
|
||||
order: CustomSortOrder.byCreatedTime,
|
||||
secondaryOrder: CustomSortOrder.folderFirst,
|
||||
sorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
secondarySorting: { order: CustomSortOrder.folderFirst, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
type: CustomSortGroupType.Outsiders
|
||||
|
@ -726,7 +740,7 @@ target-folder: by-meta True Alpha Rev
|
|||
|
||||
const expectedSortSpecForTrueAlphabeticalSorting: { [key: string]: CustomSortSpec } = {
|
||||
"True Alpha": {
|
||||
defaultOrder: CustomSortOrder.trueAlphabetical,
|
||||
defaultSorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -734,7 +748,7 @@ const expectedSortSpecForTrueAlphabeticalSorting: { [key: string]: CustomSortSpe
|
|||
targetFoldersPaths: ['True Alpha']
|
||||
},
|
||||
"True Alpha Rev": {
|
||||
defaultOrder: CustomSortOrder.trueAlphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -742,7 +756,7 @@ const expectedSortSpecForTrueAlphabeticalSorting: { [key: string]: CustomSortSpe
|
|||
targetFoldersPaths: ['True Alpha Rev']
|
||||
},
|
||||
"True Alpha withExt": {
|
||||
defaultOrder: CustomSortOrder.trueAlphabeticalWithFileExt,
|
||||
defaultSorting: { order: CustomSortOrder.trueAlphabeticalWithFileExt, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -750,7 +764,7 @@ const expectedSortSpecForTrueAlphabeticalSorting: { [key: string]: CustomSortSpe
|
|||
targetFoldersPaths: ['True Alpha withExt']
|
||||
},
|
||||
"True Alpha Rev withExt": {
|
||||
defaultOrder: CustomSortOrder.trueAlphabeticalReverseWithFileExt,
|
||||
defaultSorting: { order: CustomSortOrder.trueAlphabeticalReverseWithFileExt, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -758,7 +772,7 @@ const expectedSortSpecForTrueAlphabeticalSorting: { [key: string]: CustomSortSpe
|
|||
targetFoldersPaths: ['True Alpha Rev withExt']
|
||||
},
|
||||
"by-meta True Alpha": {
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
defaultSorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -766,8 +780,10 @@ const expectedSortSpecForTrueAlphabeticalSorting: { [key: string]: CustomSortSpe
|
|||
targetFoldersPaths: ['by-meta True Alpha']
|
||||
},
|
||||
"by-meta True Alpha Rev": {
|
||||
defaultOrder: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadataField: 'Some-attr',
|
||||
defaultSorting: {
|
||||
order: CustomSortOrder.byMetadataFieldTrueAlphabeticalReverse,
|
||||
byMetadata: 'Some-attr'
|
||||
},
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -802,19 +818,19 @@ target-folder: VS Code unicode lexicographic reverse
|
|||
|
||||
const expectedSortSpecForExoticExperimentalSorting: { [key: string]: CustomSortSpec } = {
|
||||
"VS Code unicode lexicographic": {
|
||||
defaultOrder: CustomSortOrder.vscUnicode,
|
||||
defaultSorting: { order: CustomSortOrder.vscUnicode, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.vscUnicodeReverse
|
||||
sorting: { order: CustomSortOrder.vscUnicodeReverse },
|
||||
}],
|
||||
outsidersGroupIdx: 0,
|
||||
targetFoldersPaths: ['VS Code unicode lexicographic']
|
||||
},
|
||||
"VS Code unicode lexicographic reverse": {
|
||||
defaultOrder: CustomSortOrder.vscUnicodeReverse,
|
||||
defaultSorting: { order: CustomSortOrder.vscUnicodeReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders,
|
||||
order: CustomSortOrder.vscUnicode
|
||||
sorting: { order: CustomSortOrder.vscUnicode },
|
||||
}],
|
||||
outsidersGroupIdx: 0,
|
||||
targetFoldersPaths: ['VS Code unicode lexicographic reverse']
|
||||
|
@ -1072,7 +1088,7 @@ target-folder: regexp: /!: debug: ^r10 /[^/]/.+$
|
|||
`
|
||||
|
||||
const expectedSortSpecTargetFolderRegexAndName1 = {
|
||||
defaultOrder: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1081,7 +1097,7 @@ const expectedSortSpecTargetFolderRegexAndName1 = {
|
|||
}
|
||||
|
||||
const expectedSortSpecTargetFolderByName = {
|
||||
defaultOrder: CustomSortOrder.alphabetical,
|
||||
defaultSorting: { order: CustomSortOrder.alphabetical, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1472,7 +1488,7 @@ describe('SortingSpecProcessor', () => {
|
|||
"/": {
|
||||
groups: [{
|
||||
exactText: "Nothing",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
combineWithIdx: 1,
|
||||
|
@ -1490,16 +1506,16 @@ describe('SortingSpecProcessor', () => {
|
|||
}, {
|
||||
combineWithIdx: 4,
|
||||
exactPrefix: "Abc",
|
||||
order: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
combineWithIdx: 4,
|
||||
exactSuffix: "Def",
|
||||
order: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactSuffix
|
||||
}, {
|
||||
combineWithIdx: 4,
|
||||
order: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
exactText: "Unreachable line",
|
||||
|
@ -1531,13 +1547,13 @@ describe('SortingSpecProcessor', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
"/": {
|
||||
defaultOrder: CustomSortOrder.byCreatedTime,
|
||||
defaultSecondaryOrder: CustomSortOrder.byMetadataFieldAlphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byMetadataFieldAlphabeticalReverse, },
|
||||
byMetadataFieldSecondary: "someMdataFld",
|
||||
groups: [{
|
||||
exactText: "Nothing",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.alphabetical,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.alphabetical, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
combineWithIdx: 1,
|
||||
|
@ -1555,24 +1571,24 @@ describe('SortingSpecProcessor', () => {
|
|||
}, {
|
||||
combineWithIdx: 4,
|
||||
exactPrefix: "Abc",
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: "abc-def",
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical, },
|
||||
byMetadata: "abc-def",
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical, },
|
||||
byMetadataFieldSecondary: "ghi-jkl1",
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
combineWithIdx: 4,
|
||||
exactSuffix: "Def",
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: "abc-def",
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical, },
|
||||
byMetadata: "abc-def",
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical, },
|
||||
byMetadataFieldSecondary: "ghi-jkl1",
|
||||
type: CustomSortGroupType.ExactSuffix
|
||||
}, {
|
||||
combineWithIdx: 4,
|
||||
order: CustomSortOrder.byMetadataFieldAlphabetical,
|
||||
byMetadataField: "abc-def",
|
||||
secondaryOrder: CustomSortOrder.byMetadataFieldTrueAlphabetical,
|
||||
sorting: { order: CustomSortOrder.byMetadataFieldAlphabetical, },
|
||||
byMetadata: "abc-def",
|
||||
secondarySorting: { order: CustomSortOrder.byMetadataFieldTrueAlphabetical, },
|
||||
byMetadataFieldSecondary: "ghi-jkl1",
|
||||
type: CustomSortGroupType.MatchAll
|
||||
}, {
|
||||
|
@ -1603,11 +1619,11 @@ order-desc: standard desc, < ui selected asc
|
|||
|
||||
const expectedSortSpecsStandardSortingVariants: { [key: string]: CustomSortSpec } = {
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.standardObsidian,
|
||||
defaultSecondaryOrder: CustomSortOrder.standardObsidian,
|
||||
defaultSorting: { order: CustomSortOrder.standardObsidian, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.standardObsidian, },
|
||||
groups: [{
|
||||
order: CustomSortOrder.standardObsidian,
|
||||
secondaryOrder: CustomSortOrder.standardObsidian,
|
||||
sorting: { order: CustomSortOrder.standardObsidian, },
|
||||
secondarySorting: { order: CustomSortOrder.standardObsidian, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
outsidersGroupIdx: 0,
|
||||
|
@ -1644,7 +1660,7 @@ describe('comments and higher level specs in sorting order spec', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.byCreatedTimeReverse,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1661,7 +1677,7 @@ describe('comments and higher level specs in sorting order spec', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.byCreatedTimeReverse,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1678,8 +1694,8 @@ describe('comments and higher level specs in sorting order spec', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
"mock-folder": {
|
||||
defaultOrder: CustomSortOrder.byCreatedTimeReverse,
|
||||
defaultSecondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1736,83 +1752,83 @@ describe('multi-level sorting', () => {
|
|||
"mock-folder": {
|
||||
groups: [{
|
||||
exactText: "a pre",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a pre 2",
|
||||
order: CustomSortOrder.trueAlphabeticalWithFileExt,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalWithFileExt, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a post 1",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a post 2",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a post",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a none",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a unspecified",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "a dbl specified",
|
||||
order: CustomSortOrder.trueAlphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d pre",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d pre 2",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d post 1",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d post 2",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d post",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d none",
|
||||
order: CustomSortOrder.trueAlphabeticalReverseWithFileExt,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverseWithFileExt, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d unspecified",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "d dbl specified",
|
||||
order: CustomSortOrder.trueAlphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
|
@ -1863,83 +1879,83 @@ describe('multi-level sorting', () => {
|
|||
"mock-folder": {
|
||||
groups: [{
|
||||
exactText: "a c a",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTime,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "a c d",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a ac a",
|
||||
order: CustomSortOrder.alphabeticalWithFileExt,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabeticalWithFileExt, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTimeAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a ac d",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a m a",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a m d",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a am a",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "a am d",
|
||||
order: CustomSortOrder.alphabetical,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabetical, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d c a",
|
||||
order: CustomSortOrder.alphabeticalReverseWithFileExt,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTime,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverseWithFileExt, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
}, {
|
||||
exactText: "d c d",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d ac a",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTimeAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d ac d",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byCreatedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byCreatedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d m a",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTime,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTime, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d m d",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverse,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverse, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d am a",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
exactText: "d am d",
|
||||
order: CustomSortOrder.alphabeticalReverse,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.ExactName
|
||||
},{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
|
@ -1964,7 +1980,7 @@ describe('the sorting: prefix', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.alphabetical,
|
||||
defaultSorting: { order: CustomSortOrder.alphabetical, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1980,8 +1996,8 @@ describe('the sorting: prefix', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.trueAlphabetical,
|
||||
defaultSecondaryOrder: CustomSortOrder.byModifiedTimeAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.trueAlphabetical, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byModifiedTimeAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -1997,7 +2013,7 @@ describe('the sorting: prefix', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2013,8 +2029,8 @@ describe('the sorting: prefix', () => {
|
|||
const result = processor.parseSortSpecFromText(inputTxtArr, 'mock-folder', 'custom-name-note.md')
|
||||
expect(result?.sortSpecByPath).toEqual({
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.trueAlphabeticalReverse,
|
||||
defaultSecondaryOrder: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.trueAlphabeticalReverse, },
|
||||
defaultSecondarySorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2032,8 +2048,8 @@ describe('the sorting: prefix', () => {
|
|||
expect(result?.sortSpecByPath).toEqual({
|
||||
'mock-folder': {
|
||||
groups: [{
|
||||
order: CustomSortOrder.alphabeticalReverseWithFileExt,
|
||||
secondaryOrder: CustomSortOrder.byModifiedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.alphabeticalReverseWithFileExt, },
|
||||
secondarySorting: { order: CustomSortOrder.byModifiedTimeAdvanced, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
outsidersGroupIdx: 0,
|
||||
|
@ -2063,7 +2079,7 @@ target-folder: .
|
|||
|
||||
const expectedSortSpecForMultiSpecAandB: { [key: string]: CustomSortSpec } = {
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.alphabetical,
|
||||
defaultSorting: { order: CustomSortOrder.alphabetical, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2076,7 +2092,7 @@ const expectedWildcardMatchingTreeForMultiSpecAandB: FolderMatchingTreeNode<Cust
|
|||
subtree: {
|
||||
"mock-folder": {
|
||||
matchAll: {
|
||||
"defaultOrder": CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse },
|
||||
"groups": [{
|
||||
"type": CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2084,7 +2100,7 @@ const expectedWildcardMatchingTreeForMultiSpecAandB: FolderMatchingTreeNode<Cust
|
|||
"targetFoldersPaths": ["mock-folder/*"]
|
||||
},
|
||||
matchChildren: {
|
||||
"defaultOrder": CustomSortOrder.byModifiedTime,
|
||||
defaultSorting: { order: CustomSortOrder.byModifiedTime },
|
||||
"groups": [{
|
||||
"type": CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2117,7 +2133,7 @@ const expectedWildcardMatchingTreeForMultiSpecC: FolderMatchingTreeNode<CustomSo
|
|||
subtree: {
|
||||
"mock-folder": {
|
||||
matchAll: {
|
||||
"defaultOrder": CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse },
|
||||
"groups": [{
|
||||
"type": CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2160,7 +2176,7 @@ const expectedSortSpecForMultiSpecD: { [key: string]: CustomSortSpec } = {
|
|||
|
||||
const expectedSortSpecForMultiSpecD_implicitCase: { [key: string]: CustomSortSpec } = {
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2190,7 +2206,7 @@ const expectedWildcardMatchingTreeForMultiSpecD_implicitCase: FolderMatchingTree
|
|||
subtree: {
|
||||
"mock-folder": {
|
||||
matchAll: {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
"groups": [{
|
||||
"type": CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2227,7 +2243,7 @@ const expectedSortSpecForMultiSpecE: { [key: string]: CustomSortSpec } = {
|
|||
|
||||
const expectedSortSpecForMultiSpecE_implicitCase: { [key: string]: CustomSortSpec } = {
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2257,7 +2273,7 @@ const expectedWildcardMatchingTreeForMultiSpecE_implicitCase: FolderMatchingTree
|
|||
subtree: {
|
||||
"mock-folder": {
|
||||
matchChildren: {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
"groups": [{
|
||||
"type": CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2282,7 +2298,7 @@ const expectedWildcardMatchingTreeForMultiSpecDplusE_implicitCase: FolderMatchin
|
|||
"targetFoldersPaths": ["mock-folder/*"]
|
||||
},
|
||||
matchChildren: {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
"groups": [{
|
||||
"type": CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2305,7 +2321,7 @@ target-folder: mock-folder
|
|||
|
||||
const expectedSortSpecForMultiSpecF_implicitCase: { [key: string]: CustomSortSpec } = {
|
||||
'mock-folder': {
|
||||
defaultOrder: CustomSortOrder.alphabeticalReverse,
|
||||
defaultSorting: { order: CustomSortOrder.alphabeticalReverse, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2422,7 +2438,7 @@ target-folder: AA
|
|||
|
||||
const expectedSortSpecForAdvancedFolderDateSortingMethods: { [key: string]: CustomSortSpec } = {
|
||||
'A': {
|
||||
defaultOrder: CustomSortOrder.byModifiedTimeAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.byModifiedTimeAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2430,7 +2446,7 @@ const expectedSortSpecForAdvancedFolderDateSortingMethods: { [key: string]: Cust
|
|||
targetFoldersPaths: ['A']
|
||||
},
|
||||
'B': {
|
||||
defaultOrder: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2438,7 +2454,7 @@ const expectedSortSpecForAdvancedFolderDateSortingMethods: { [key: string]: Cust
|
|||
targetFoldersPaths: ['B']
|
||||
},
|
||||
'C': {
|
||||
defaultOrder: CustomSortOrder.byCreatedTimeAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTimeAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2446,7 +2462,7 @@ const expectedSortSpecForAdvancedFolderDateSortingMethods: { [key: string]: Cust
|
|||
targetFoldersPaths: ['C']
|
||||
},
|
||||
'D': {
|
||||
defaultOrder: CustomSortOrder.byCreatedTimeReverseAdvanced,
|
||||
defaultSorting: { order: CustomSortOrder.byCreatedTimeReverseAdvanced, },
|
||||
groups: [{
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}],
|
||||
|
@ -2456,41 +2472,41 @@ const expectedSortSpecForAdvancedFolderDateSortingMethods: { [key: string]: Cust
|
|||
'AA': {
|
||||
groups: [{
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byModifiedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeAdvanced, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}, {
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.byModifiedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.Outsiders
|
||||
}, {
|
||||
exactPrefix: 'Archive',
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byCreatedTimeAdvanced,
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeAdvanced, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
exactPrefix: 'Archive',
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.byCreatedTimeReverseAdvanced,
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeReverseAdvanced, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
exactPrefix: 'Deep1',
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byCreatedTimeAdvancedRecursive,
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeAdvancedRecursive, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
exactPrefix: 'Deep2',
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.byCreatedTimeReverseAdvancedRecursive,
|
||||
sorting: { order: CustomSortOrder.byCreatedTimeReverseAdvancedRecursive, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
exactPrefix: 'Deep3',
|
||||
foldersOnly: true,
|
||||
order: CustomSortOrder.byModifiedTimeAdvancedRecursive,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeAdvancedRecursive, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}, {
|
||||
exactPrefix: 'Deep4',
|
||||
filesOnly: true,
|
||||
order: CustomSortOrder.byModifiedTimeReverseAdvancedRecursive,
|
||||
sorting: { order: CustomSortOrder.byModifiedTimeReverseAdvancedRecursive, },
|
||||
type: CustomSortGroupType.ExactPrefix
|
||||
}],
|
||||
outsidersFilesGroupIdx: 1,
|
||||
|
|
Loading…
Reference in New Issue