@@ -29,7 +29,7 @@ describe("vscode", () => {
29
29
expect ( resp . status ) . toBe ( 200 )
30
30
const html = await resp . text ( )
31
31
const url = new URL ( resp . url ) // Check there were no redirections.
32
- expect ( url . pathname + decodeURIComponent ( url . search ) ) . toBe ( route )
32
+ expect ( url . pathname + url . search ) . toBe ( route )
33
33
switch ( route ) {
34
34
case "/" :
35
35
case "/vscode/" :
@@ -42,7 +42,7 @@ describe("vscode", () => {
42
42
}
43
43
} )
44
44
45
- it ( "should redirect to the passed in workspace" , async ( ) => {
45
+ it ( "should redirect to the passed in workspace using human-readable query " , async ( ) => {
46
46
const workspace = path . join ( await tmpdir ( testName ) , "test.code-workspace" )
47
47
await fs . writeFile ( workspace , "" )
48
48
codeServer = await integration . setup ( [ "--auth=none" , workspace ] , "" )
@@ -53,7 +53,7 @@ describe("vscode", () => {
53
53
expect ( url . search ) . toBe ( `?workspace=${ workspace } ` )
54
54
} )
55
55
56
- it ( "should redirect to the passed in directory " , async ( ) => {
56
+ it ( "should redirect to the passed in folder using human-readable query " , async ( ) => {
57
57
const folder = await tmpdir ( testName )
58
58
codeServer = await integration . setup ( [ "--auth=none" , folder ] , "" )
59
59
@@ -81,34 +81,21 @@ describe("vscode", () => {
81
81
resp = await codeServer . fetch ( route )
82
82
const url = new URL ( resp . url )
83
83
expect ( url . pathname ) . toBe ( route )
84
- expect ( decodeURIComponent ( url . search ) ) . toBe ( `?folder=${ folder } &workspace=${ workspace } ` )
84
+ expect ( url . search ) . toBe ( `?folder=${ folder } &workspace=${ workspace } ` )
85
85
await resp . text ( )
86
86
}
87
87
88
88
// Closing the folder should stop the redirecting.
89
89
resp = await codeServer . fetch ( "/" , undefined , { ew : "true" } )
90
90
let url = new URL ( resp . url )
91
91
expect ( url . pathname ) . toBe ( "/" )
92
- expect ( decodeURIComponent ( url . search ) ) . toBe ( "?ew=true" )
92
+ expect ( url . search ) . toBe ( "?ew=true" )
93
93
await resp . text ( )
94
94
95
95
resp = await codeServer . fetch ( "/" )
96
96
url = new URL ( resp . url )
97
97
expect ( url . pathname ) . toBe ( "/" )
98
- expect ( decodeURIComponent ( url . search ) ) . toBe ( "" )
99
- await resp . text ( )
100
- } )
101
-
102
- it ( "should add the workspace as a query param maintaining the slashes" , async ( ) => {
103
- const workspace = path . join ( await tmpdir ( testName ) , "test.code-workspace" )
104
- await fs . writeFile ( workspace , "" )
105
- codeServer = await integration . setup ( [ "--auth=none" , workspace ] , "" )
106
-
107
- let resp = await codeServer . fetch ( "/" , undefined )
108
-
109
- expect ( resp . status ) . toBe ( 200 )
110
- const url = new URL ( resp . url )
111
- expect ( url . search ) . toBe ( `?workspace=${ workspace } ` )
98
+ expect ( url . search ) . toBe ( "" )
112
99
await resp . text ( )
113
100
} )
114
101
@@ -123,18 +110,6 @@ describe("vscode", () => {
123
110
await resp . text ( )
124
111
} )
125
112
126
- it ( "should add the folder as a query param maintaining the slashes" , async ( ) => {
127
- const folder = await tmpdir ( testName )
128
- codeServer = await integration . setup ( [ "--auth=none" , folder ] , "" )
129
-
130
- let resp = await codeServer . fetch ( "/" , undefined )
131
-
132
- expect ( resp . status ) . toBe ( 200 )
133
- const url = new URL ( resp . url )
134
- expect ( url . search ) . toBe ( `?folder=${ folder } ` )
135
- await resp . text ( )
136
- } )
137
-
138
113
it ( "should not redirect when last opened is ignored" , async ( ) => {
139
114
codeServer = await integration . setup ( [ "--auth=none" , "--ignore-last-opened" ] , "" )
140
115
@@ -151,7 +126,7 @@ describe("vscode", () => {
151
126
resp = await codeServer . fetch ( "/" )
152
127
const url = new URL ( resp . url )
153
128
expect ( url . pathname ) . toBe ( "/" )
154
- expect ( decodeURIComponent ( url . search ) ) . toBe ( "" )
129
+ expect ( url . search ) . toBe ( "" )
155
130
await resp . text ( )
156
131
} )
157
132
} )
0 commit comments