-
-
Notifications
You must be signed in to change notification settings - Fork 176
Expand file tree
/
Copy pathlocalBrowseUi.test.ts
More file actions
19 lines (16 loc) · 959 Bytes
/
Copy pathlocalBrowseUi.test.ts
File metadata and controls
19 lines (16 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { describe, expect, it } from 'vitest'
import { decodeBrowsePath } from './localBrowseUi'
describe('decodeBrowsePath', () => {
it('removes the browse-route slash before Windows drive paths', () => {
expect(decodeBrowsePath('/C:/Users/Nulled/video.mp4', 'win32')).toBe('C:/Users/Nulled/video.mp4')
expect(decodeBrowsePath('/%43%3A/Users/Nulled/file.ps1', 'win32')).toBe('C:/Users/Nulled/file.ps1')
})
it('preserves Unix, UNC, and already normalized paths', () => {
expect(decodeBrowsePath('/home/codex/file.txt', 'linux')).toBe('/home/codex/file.txt')
expect(decodeBrowsePath('//server/share/file.txt', 'win32')).toBe('//server/share/file.txt')
expect(decodeBrowsePath('C:/Users/Nulled/file.txt', 'win32')).toBe('C:/Users/Nulled/file.txt')
})
it('leaves malformed URL encoding usable for the normal validation path', () => {
expect(decodeBrowsePath('/tmp/100%/file.txt', 'linux')).toBe('/tmp/100%/file.txt')
})
})