@@ -43,6 +43,7 @@ describe("parser", () => {
4343 delete process . env . PASSWORD
4444 delete process . env . CS_DISABLE_FILE_DOWNLOADS
4545 delete process . env . CS_DISABLE_GETTING_STARTED_OVERRIDE
46+ delete process . env . VSCODE_PROXY_URI
4647 console . log = jest . fn ( )
4748 } )
4849
@@ -457,6 +458,31 @@ describe("parser", () => {
457458 port : 8082 ,
458459 } )
459460 } )
461+
462+ it ( "should not set proxy uri" , async ( ) => {
463+ await setDefaults ( parse ( [ ] ) )
464+ expect ( process . env . VSCODE_PROXY_URI ) . toBeUndefined ( )
465+ } )
466+
467+ it ( "should set proxy uri" , async ( ) => {
468+ await setDefaults ( parse ( [ "--proxy-domain" , "coder.org" ] ) )
469+ expect ( process . env . VSCODE_PROXY_URI ) . toEqual ( "{{port}}.coder.org" )
470+ } )
471+
472+ it ( "should set proxy uri to first domain" , async ( ) => {
473+ await setDefaults (
474+ parse ( [ "--proxy-domain" , "*.coder.com" , "--proxy-domain" , "coder.com" , "--proxy-domain" , "coder.org" ] ) ,
475+ )
476+ expect ( process . env . VSCODE_PROXY_URI ) . toEqual ( "{{port}}.coder.com" )
477+ } )
478+
479+ it ( "should not override existing proxy uri" , async ( ) => {
480+ process . env . VSCODE_PROXY_URI = "foo"
481+ await setDefaults (
482+ parse ( [ "--proxy-domain" , "*.coder.com" , "--proxy-domain" , "coder.com" , "--proxy-domain" , "coder.org" ] ) ,
483+ )
484+ expect ( process . env . VSCODE_PROXY_URI ) . toEqual ( "foo" )
485+ } )
460486} )
461487
462488describe ( "cli" , ( ) => {
0 commit comments