mirror of
https://github.com/coder/code-server.git
synced 2025-07-29 04:52:53 +08:00
refactor: move jest and add package.json to /test
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import * as assert from "assert"
|
||||
import * as express from "express"
|
||||
import * as httpserver from "./httpserver"
|
||||
import * as integration from "./integration"
|
||||
@ -8,7 +7,7 @@ describe("proxy", () => {
|
||||
const nhooyrDevServer = new httpserver.HttpServer()
|
||||
let proxyPath: string
|
||||
|
||||
before(async () => {
|
||||
beforeAll(async () => {
|
||||
const e = express.default()
|
||||
await nhooyrDevServer.listen(e)
|
||||
e.get("/wsup", (req, res) => {
|
||||
@ -20,7 +19,7 @@ describe("proxy", () => {
|
||||
})
|
||||
})
|
||||
|
||||
after(async () => {
|
||||
afterAll(async () => {
|
||||
await nhooyrDevServer.close()
|
||||
})
|
||||
|
||||
@ -34,14 +33,16 @@ describe("proxy", () => {
|
||||
it("should rewrite the base path", async () => {
|
||||
;[, , codeServer] = await integration.setup(["--auth=none"], "")
|
||||
const resp = await codeServer.fetch(proxyPath)
|
||||
assert.equal(resp.status, 200)
|
||||
assert.equal(await resp.json(), "asher is the best")
|
||||
expect(resp.status).toBe(200)
|
||||
const json = await resp.json()
|
||||
expect(json).toBe("asher is the best")
|
||||
})
|
||||
|
||||
it("should not rewrite the base path", async () => {
|
||||
;[, , codeServer] = await integration.setup(["--auth=none", "--proxy-path-passthrough=true"], "")
|
||||
const resp = await codeServer.fetch(proxyPath)
|
||||
assert.equal(resp.status, 200)
|
||||
assert.equal(await resp.json(), "joe is the best")
|
||||
expect(resp.status).toBe(200)
|
||||
const json = await resp.json()
|
||||
expect(json).toBe("joe is the best")
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user