Archived
1
0

refactor: match /test/unit structure to /src

This commit is contained in:
Joe Previte
2021-07-27 16:52:57 -07:00
parent 7a5c457209
commit 7a6ec202ba
26 changed files with 43 additions and 43 deletions

View File

@ -0,0 +1,52 @@
import * as cs from "code-server"
import * as fspath from "path"
export const plugin: cs.Plugin = {
displayName: "Test Plugin",
routerPath: "/test-plugin",
homepageURL: "https://example.com",
description: "Plugin used in code-server tests.",
init(config) {
config.logger.debug("test-plugin loaded!")
},
router() {
const r = cs.express.Router()
r.get("/test-app", (_, res) => {
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
})
r.get("/goland/icon.svg", (_, res) => {
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
})
r.get("/error", () => {
throw new cs.HttpError("error", cs.HttpCode.LargePayload)
})
return r
},
wsRouter() {
const wr = cs.WsRouter()
wr.ws("/test-app", (req) => {
cs.wss.handleUpgrade(req, req.ws, req.head, (ws) => {
req.ws.resume()
ws.send("hello")
})
})
return wr
},
applications() {
return [
{
name: "Test App",
version: "4.0.0",
iconPath: "/icon.svg",
path: "/test-app",
description: "This app does XYZ.",
homepageURL: "https://example.com",
},
]
},
}