|
|
|
@ -25,11 +25,11 @@ describe('file uri both platforms', () => {
|
|
|
|
test('converts path to file url', () => {
|
|
|
|
test('converts path to file url', () => {
|
|
|
|
expect(pathToFileURL('/test.jpg').href).toMatch(/^file:\/{3}.*test\.jpg$/);
|
|
|
|
expect(pathToFileURL('/test.jpg').href).toMatch(/^file:\/{3}.*test\.jpg$/);
|
|
|
|
|
|
|
|
|
|
|
|
expect(pathToFileURL('/Users/sindresorhus/dev/te^st.jpg').href).toMatch(/^file:\/{2}.*\/Users\/sindresorhus\/dev\/te\^st\.jpg$/);
|
|
|
|
expect(pathToFileURL('/Users/sindresorhus/dev/te^st.jpg').href).toMatch(/^file:\/{2}.*\/Users\/sindresorhus\/dev\/te%5Est\.jpg$/);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('escapes more special characters in path', () => {
|
|
|
|
test('escapes more special characters in path', () => {
|
|
|
|
expect(pathToFileURL('/a^?!@#$%&\'";<>').href).toMatch(/^file:\/{3}.*a\^%3F!@%23\$%25&'%22;%3C%3E$/);
|
|
|
|
expect(pathToFileURL('/a^?!@#$%&\'";<>').href).toMatch(/^file:\/{3}.*a%5E%3F!@%23\$%25&'%22;%3C%3E$/);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
test('escapes whitespace characters in path', () => {
|
|
|
|
test('escapes whitespace characters in path', () => {
|
|
|
|
|