@@ -92,5 +92,51 @@ describe("login", () => {
9292
9393 expect ( htmlContent ) . toContain ( "Incorrect password" )
9494 } )
95+
96+ it ( "should return correct app-name" , async ( ) => {
97+ process . env . PASSWORD = previousEnvPassword
98+ const appName = "testnäme"
99+ const codeServer = await integration . setup ( [ `--app-name=${ appName } ` ] , "" )
100+ const resp = await codeServer . fetch ( "/login" , { method : "GET" } )
101+
102+ const htmlContent = await resp . text ( )
103+ expect ( resp . status ) . toBe ( 200 )
104+ expect ( htmlContent ) . toContain ( `${ appName } </h1>` )
105+ expect ( htmlContent ) . toContain ( `<title>${ appName } login</title>` )
106+ } )
107+
108+ it ( "should return correct app-name when unset" , async ( ) => {
109+ process . env . PASSWORD = previousEnvPassword
110+ const appName = "code-server"
111+ const codeServer = await integration . setup ( [ ] , "" )
112+ const resp = await codeServer . fetch ( "/login" , { method : "GET" } )
113+
114+ const htmlContent = await resp . text ( )
115+ expect ( resp . status ) . toBe ( 200 )
116+ expect ( htmlContent ) . toContain ( `${ appName } </h1>` )
117+ expect ( htmlContent ) . toContain ( `<title>${ appName } login</title>` )
118+ } )
119+
120+ it ( "should return correct welcome text" , async ( ) => {
121+ process . env . PASSWORD = previousEnvPassword
122+ const welcomeText = "Welcome to your code workspace! öäü🔐"
123+ const codeServer = await integration . setup ( [ `--welcome-text=${ welcomeText } ` ] , "" )
124+ const resp = await codeServer . fetch ( "/login" , { method : "GET" } )
125+
126+ const htmlContent = await resp . text ( )
127+ expect ( resp . status ) . toBe ( 200 )
128+ expect ( htmlContent ) . toContain ( welcomeText )
129+ } )
130+
131+ it ( "should return correct welcome text when none is set but app-name is" , async ( ) => {
132+ process . env . PASSWORD = previousEnvPassword
133+ const appName = "testnäme"
134+ const codeServer = await integration . setup ( [ `--app-name=${ appName } ` ] , "" )
135+ const resp = await codeServer . fetch ( "/login" , { method : "GET" } )
136+
137+ const htmlContent = await resp . text ( )
138+ expect ( resp . status ) . toBe ( 200 )
139+ expect ( htmlContent ) . toContain ( `Welcome to ${ appName } ` )
140+ } )
95141 } )
96142} )
0 commit comments