Skip to content

Commit 02f4e00

Browse files
committed
Add test for invalid password
1 parent f4a8c9d commit 02f4e00

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

+15
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,20 @@ describe("login", () => {
7272

7373
expect(htmlContent).toContain("Missing password")
7474
})
75+
76+
it("should return HTML with 'Incorrect password' message", async () => {
77+
const params = new URLSearchParams()
78+
params.append("password", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
79+
const resp = await codeServer().fetch("/login", {
80+
method: "POST",
81+
body: params,
82+
})
83+
84+
expect(resp.status).toBe(200)
85+
86+
const htmlContent = await resp.text()
87+
88+
expect(htmlContent).toContain("Incorrect password")
89+
})
7590
})
7691
})

0 commit comments

Comments
 (0)