Skip to content

Commit e89a9af

Browse files
strickvlclaude
andcommitted
test: remove outdated tests for deprecated custom UI flags
Remove tests for legacy individual flags (--login-title, --password-placeholder, --submit-text, etc.) that have been replaced by the unified --custom-strings flag. Also remove cleanup of non-existent environment variables in CLI tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent af2f599 commit e89a9af

File tree

2 files changed

+0
-68
lines changed

2 files changed

+0
-68
lines changed

test/unit/node/cli.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ describe("parser", () => {
4949
delete process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE
5050
delete process.env.VSCODE_PROXY_URI
5151
delete process.env.CS_DISABLE_PROXY
52-
delete process.env.CS_LOGIN_TITLE
53-
delete process.env.CS_LOGIN_ENV_PASSWORD_MSG
54-
delete process.env.CS_PASSWORD_PLACEHOLDER
55-
delete process.env.CS_SUBMIT_TEXT
5652
console.log = jest.fn()
5753
})
5854

test/unit/node/routes/login.test.ts

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -147,69 +147,5 @@ describe("login", () => {
147147
expect(htmlContent).toContain(`欢迎来到 code-server`)
148148
})
149149

150-
it("should return custom login title", async () => {
151-
process.env.PASSWORD = previousEnvPassword
152-
const loginTitle = "Custom Access Portal"
153-
const codeServer = await integration.setup([`--login-title=${loginTitle}`], "")
154-
const resp = await codeServer.fetch("/login", { method: "GET" })
155-
156-
const htmlContent = await resp.text()
157-
expect(resp.status).toBe(200)
158-
expect(htmlContent).toContain(`<title>${loginTitle}</title>`)
159-
})
160-
161-
it("should return custom password placeholder", async () => {
162-
process.env.PASSWORD = previousEnvPassword
163-
const placeholder = "Enter access code"
164-
const codeServer = await integration.setup([`--password-placeholder=${placeholder}`], "")
165-
const resp = await codeServer.fetch("/login", { method: "GET" })
166-
167-
const htmlContent = await resp.text()
168-
expect(resp.status).toBe(200)
169-
expect(htmlContent).toContain(`placeholder="${placeholder}"`)
170-
})
171-
172-
it("should return custom submit button text", async () => {
173-
process.env.PASSWORD = previousEnvPassword
174-
const submitText = "ACCESS PORTAL"
175-
const codeServer = await integration.setup([`--submit-text=${submitText}`], "")
176-
const resp = await codeServer.fetch("/login", { method: "GET" })
177-
178-
const htmlContent = await resp.text()
179-
expect(resp.status).toBe(200)
180-
expect(htmlContent).toContain(`value="${submitText}"`)
181-
})
182-
183-
it("should return custom env password message", async () => {
184-
const envMessage = "Password configured via container environment"
185-
const codeServer = await integration.setup([`--login-env-password-msg=${envMessage}`, `--password=test123`], "")
186-
const resp = await codeServer.fetch("/login", { method: "GET" })
187-
188-
const htmlContent = await resp.text()
189-
expect(resp.status).toBe(200)
190-
expect(htmlContent).toContain(envMessage)
191-
})
192-
193-
it("should escape HTML in custom messages", async () => {
194-
process.env.PASSWORD = previousEnvPassword
195-
const maliciousTitle = "<script>alert('xss')</script>"
196-
const codeServer = await integration.setup([`--login-title=${maliciousTitle}`, `--password=test123`], "")
197-
const resp = await codeServer.fetch("/login", { method: "GET" })
198-
199-
const htmlContent = await resp.text()
200-
expect(resp.status).toBe(200)
201-
expect(htmlContent).toContain("&lt;script&gt;alert(&apos;xss&apos;)&lt;/script&gt;")
202-
expect(htmlContent).not.toContain("<script>alert('xss')</script>")
203-
})
204-
205-
it("should return custom error messages", async () => {
206-
const customMissingMsg = "Access code required"
207-
const codeServer = await integration.setup([`--missing-password-msg=${customMissingMsg}`, `--password=test123`], "")
208-
const resp = await codeServer.fetch("/login", { method: "POST" })
209-
210-
const htmlContent = await resp.text()
211-
expect(resp.status).toBe(200)
212-
expect(htmlContent).toContain(customMissingMsg)
213-
})
214150
})
215151
})

0 commit comments

Comments
 (0)