返回 oh-my-ppt
local-asset.test.ts
根目录 / tests / unit / shared / local-asset.test.ts
1 import { describe, expect, it } from 'vitest'
2 import { localAssetUrl } from '../../../src/shared/local-asset'
3
4 describe('localAssetUrl', () => {
5 it('encodes Windows absolute paths without turning the drive into the URL host', () => {
6 expect(localAssetUrl('C:\\Users\\Chan\\thumbnail.png')).toBe(
7 'local-asset://C%3A%5CUsers%5CChan%5Cthumbnail.png'
8 )
9 })
10
11 it('encodes URI delimiters in asset paths', () => {
12 expect(localAssetUrl('/tmp/a?#.png')).toBe('local-asset://%2Ftmp%2Fa%3F%23.png')
13 })
14 })
15
15 lines TYPESCRIPT