plugin: Give test-plugin some html to test overlay
This commit is contained in:
parent
197a09f0c1
commit
9d39c53c99
@ -5,6 +5,8 @@ import { PluginAPI } from "../src/node/plugin"
|
|||||||
import * as supertest from "supertest"
|
import * as supertest from "supertest"
|
||||||
import * as express from "express"
|
import * as express from "express"
|
||||||
import * as apps from "../src/node/routes/apps"
|
import * as apps from "../src/node/routes/apps"
|
||||||
|
import * as fs from "fs"
|
||||||
|
const fsp = fs.promises
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use $LOG_LEVEL=debug to see debug logs.
|
* Use $LOG_LEVEL=debug to see debug logs.
|
||||||
@ -52,6 +54,9 @@ describe("plugin", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("/test-plugin/test-app", async () => {
|
it("/test-plugin/test-app", async () => {
|
||||||
await agent.get("/test-plugin/test-app").expect(200, { date: "2000-02-05T05:00:00.000Z" })
|
const indexHTML = await fsp.readFile(path.join(__dirname, "test-plugin/public/index.html"), {
|
||||||
|
encoding: "utf8",
|
||||||
|
})
|
||||||
|
await agent.get("/test-plugin/test-app").expect(200, indexHTML)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
10
test/test-plugin/public/index.html
Normal file
10
test/test-plugin/public/index.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>Test Plugin</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Welcome to the test plugin!</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -15,9 +15,7 @@ export const plugin: pluginapi.Plugin = {
|
|||||||
router() {
|
router() {
|
||||||
const r = express.Router()
|
const r = express.Router()
|
||||||
r.get("/test-app", (req, res) => {
|
r.get("/test-app", (req, res) => {
|
||||||
res.json({
|
res.sendFile(fspath.resolve(__dirname, "../public/index.html"))
|
||||||
date: new Date("2000/02/05"),
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
r.get("/goland/icon.svg", (req, res) => {
|
r.get("/goland/icon.svg", (req, res) => {
|
||||||
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
|
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
|
||||||
|
Loading…
Reference in New Issue
Block a user