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