mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-18 15:23:13 +00:00
fix(settings): harden locations and site login matching
This commit is contained in:
@@ -11,9 +11,11 @@ vi.mock('@tauri-apps/api/path', () => ({
|
||||
import {
|
||||
downloadLocationEquals,
|
||||
DEFAULT_CATEGORY_SUBFOLDERS,
|
||||
formatDerivedCategoryPath,
|
||||
normalizeCategorySubfolder,
|
||||
normalizeDownloadLocationSettings,
|
||||
resolveCategoryDestination
|
||||
resolveCategoryDestination,
|
||||
subfolderFromDerivedCategoryPath
|
||||
} from './downloadLocations';
|
||||
|
||||
describe('download locations', () => {
|
||||
@@ -68,4 +70,21 @@ describe('download locations', () => {
|
||||
expect(normalizeCategorySubfolder('C:\\Media\\Movies', 'Movies')).toBe('Media/Movies');
|
||||
expect(normalizeCategorySubfolder('../../', 'Movies')).toBe('Movies');
|
||||
});
|
||||
|
||||
it('formats and parses derived category paths with platform path separators', () => {
|
||||
expect(formatDerivedCategoryPath('/Users/test/Downloads', 'Video Files'))
|
||||
.toBe('/Users/test/Downloads/Video Files');
|
||||
expect(formatDerivedCategoryPath('D:\\Downloads', 'Video Files'))
|
||||
.toBe('D:\\Downloads\\Video Files');
|
||||
expect(subfolderFromDerivedCategoryPath(
|
||||
'D:\\Downloads\\Video Files',
|
||||
'd:\\downloads'
|
||||
)).toBe('Video Files');
|
||||
expect(subfolderFromDerivedCategoryPath(
|
||||
'/Users/test/Downloads/Video Files',
|
||||
'/Users/test/Downloads'
|
||||
)).toBe('Video Files');
|
||||
expect(subfolderFromDerivedCategoryPath('/Volumes/Media', '/Users/test/Downloads'))
|
||||
.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user