@@ -25,6 +25,18 @@ describe("Convert", () => {
25
25
} )
26
26
27
27
describe ( "pathToUri" , ( ) => {
28
+ it ( "does not convert path other than file:" , ( ) => {
29
+ expect ( Convert . pathToUri ( "http://atom.io/a" ) ) . toBe ( "http://atom.io/a" )
30
+ expect ( Convert . pathToUri ( "https://atom.io/b" ) ) . toBe ( "https://atom.io/b" )
31
+ expect ( Convert . pathToUri ( "deno:/hello.js" ) ) . toBe ( "deno:/hello.js" )
32
+ } )
33
+
34
+ it ( "does not convert non-alphanumeric path other than file:" , ( ) => {
35
+ expect ( Convert . pathToUri ( "http://atom.io/a%40%E3%81%82" ) ) . toBe ( "http://atom.io/a%40%E3%81%82" )
36
+ expect ( Convert . pathToUri ( "https://atom.io/b?foo=bar" ) ) . toBe ( "https://atom.io/b?foo=bar" )
37
+ expect ( Convert . pathToUri ( "deno:/hello%40%E3%81%82.js" ) ) . toBe ( "deno:/hello%40%E3%81%82.js" )
38
+ } )
39
+
28
40
it ( "prefixes an absolute path with file://" , ( ) => {
29
41
expect ( Convert . pathToUri ( "/a/b/c/d.txt" ) ) . toBe ( "file:///a/b/c/d.txt" )
30
42
} )
@@ -47,10 +59,18 @@ describe("Convert", () => {
47
59
} )
48
60
49
61
describe ( "uriToPath" , ( ) => {
50
- it ( "does not convert http: and https: uri's " , ( ) => {
62
+ it ( "does not convert uri other than file: " , ( ) => {
51
63
setProcessPlatform ( "darwin" )
52
64
expect ( Convert . uriToPath ( "http://atom.io/a" ) ) . toBe ( "http://atom.io/a" )
53
65
expect ( Convert . uriToPath ( "https://atom.io/b" ) ) . toBe ( "https://atom.io/b" )
66
+ expect ( Convert . uriToPath ( "deno:/hello.js" ) ) . toBe ( "deno:/hello.js" )
67
+ } )
68
+
69
+ it ( "does not convert non-alphanumeric uri other than file:" , ( ) => {
70
+ setProcessPlatform ( "darwin" )
71
+ expect ( Convert . uriToPath ( "http://atom.io/a%40%E3%81%82" ) ) . toBe ( "http://atom.io/a%40%E3%81%82" )
72
+ expect ( Convert . uriToPath ( "https://atom.io/b?foo=bar" ) ) . toBe ( "https://atom.io/b?foo=bar" )
73
+ expect ( Convert . uriToPath ( "deno:/hello%40%E3%81%82.js" ) ) . toBe ( "deno:/hello%40%E3%81%82.js" )
54
74
} )
55
75
56
76
it ( "converts a file:// path to an absolute path" , ( ) => {
0 commit comments