@@ -43,6 +43,7 @@ describe("parser", () => {
43
43
delete process . env . PASSWORD
44
44
delete process . env . CS_DISABLE_FILE_DOWNLOADS
45
45
delete process . env . CS_DISABLE_GETTING_STARTED_OVERRIDE
46
+ delete process . env . VSCODE_PROXY_URI
46
47
console . log = jest . fn ( )
47
48
} )
48
49
@@ -457,6 +458,29 @@ describe("parser", () => {
457
458
port : 8082 ,
458
459
} )
459
460
} )
461
+
462
+ it ( "should not set proxy uri without proxy domains" , async ( ) => {
463
+ await setDefaults ( parse ( [ ] ) )
464
+ expect ( process . env . VSCODE_PROXY_URI ) . toBeUndefined ( )
465
+ } )
466
+
467
+ it ( "should set proxy uri to first domain" , async ( ) => {
468
+ await setDefaults ( parse ( [ "--proxy-domain" , "coder.org" ] ) , )
469
+ expect ( process . env . VSCODE_PROXY_URI ) . toEqual ( "{{port}}.coder.org" )
470
+
471
+ await setDefaults (
472
+ parse ( [ "--proxy-domain" , "*.coder.com" , "--proxy-domain" , "coder.com" , "--proxy-domain" , "coder.org" ] ) ,
473
+ )
474
+ expect ( process . env . VSCODE_PROXY_URI ) . toEqual ( "{{port}}.coder.com" )
475
+ } )
476
+
477
+ it ( "should not override existing proxy uri" , async ( ) => {
478
+ process . env . VSCODE_PROXY_URI = "foo"
479
+ await setDefaults (
480
+ parse ( [ "--proxy-domain" , "*.coder.com" , "--proxy-domain" , "coder.com" , "--proxy-domain" , "coder.org" ] ) ,
481
+ )
482
+ expect ( process . env . VSCODE_PROXY_URI ) . toEqual ( "foo" )
483
+ } )
460
484
} )
461
485
462
486
describe ( "cli" , ( ) => {
0 commit comments