Skip to content

Commit e4fecc9

Browse files
committed
wip: add error test
1 parent 676f13d commit e4fecc9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/unit/proxy.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,21 @@ describe("proxy", () => {
129129
expect(resp.status).toBe(404)
130130
expect(resp.statusText).toMatch("Not Found")
131131
})
132+
133+
it("should handle errors", async () => {
134+
e.use(bodyParser.json({ strict: false }))
135+
e.post("/wsup", (req, res) => {
136+
throw new Error("BROKEN")
137+
})
138+
codeServer = await integration.setup(["--auth=none"], "")
139+
const resp = await codeServer.fetch(proxyPath, {
140+
method: "post",
141+
body: JSON.stringify("coder is the best"),
142+
headers: {
143+
"Content-Type": "application/json",
144+
},
145+
})
146+
expect(resp.status).toBe(500)
147+
expect(resp.statusText).toMatch("Internal Server Error")
148+
})
132149
})

0 commit comments

Comments
 (0)