2020-10-30 08:18:59 +01:00
|
|
|
import { logger } from "@coder/logger"
|
|
|
|
import * as assert from "assert"
|
2020-10-30 08:26:30 +01:00
|
|
|
import { describe } from "mocha"
|
|
|
|
import * as path from "path"
|
|
|
|
import { PluginAPI } from "../src/node/plugin"
|
2020-10-30 08:18:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Use $LOG_LEVEL=debug to see debug logs.
|
|
|
|
*/
|
|
|
|
describe("plugin", () => {
|
|
|
|
it("loads", async () => {
|
|
|
|
const papi = new PluginAPI(logger, path.resolve(__dirname, "test-plugin") + ":meow")
|
|
|
|
await papi.loadPlugins()
|
|
|
|
|
2020-11-03 22:24:06 +01:00
|
|
|
const apps = await papi.applications()
|
2020-10-30 08:18:59 +01:00
|
|
|
|
2020-10-30 08:26:30 +01:00
|
|
|
assert.deepEqual(
|
|
|
|
[
|
|
|
|
{
|
2020-11-04 03:14:19 +01:00
|
|
|
name: "Test App",
|
2020-10-30 08:26:30 +01:00
|
|
|
version: "4.0.0",
|
2020-11-04 03:11:14 +01:00
|
|
|
|
2020-11-04 03:14:19 +01:00
|
|
|
description: "This app does XYZ.",
|
2020-11-04 03:42:21 +01:00
|
|
|
iconPath: "/test-plugin/test-app/icon.svg",
|
2020-11-04 03:45:25 +01:00
|
|
|
homepageURL: "https://example.com",
|
2020-11-04 03:42:21 +01:00
|
|
|
path: "/test-plugin/test-app",
|
2020-11-04 03:11:14 +01:00
|
|
|
|
2020-10-30 08:26:30 +01:00
|
|
|
plugin: {
|
|
|
|
name: "test-plugin",
|
|
|
|
version: "1.0.0",
|
2020-10-30 08:37:42 +01:00
|
|
|
modulePath: path.join(__dirname, "test-plugin"),
|
2020-11-04 03:11:14 +01:00
|
|
|
|
|
|
|
displayName: "Test Plugin",
|
2020-11-04 03:14:19 +01:00
|
|
|
description: "Plugin used in code-server tests.",
|
2020-11-04 03:42:21 +01:00
|
|
|
routerPath: "/test-plugin",
|
2020-11-04 03:45:25 +01:00
|
|
|
homepageURL: "https://example.com",
|
2020-10-30 08:26:30 +01:00
|
|
|
},
|
2020-10-30 08:18:59 +01:00
|
|
|
},
|
2020-10-30 08:26:30 +01:00
|
|
|
],
|
|
|
|
apps,
|
|
|
|
)
|
2020-10-30 08:18:59 +01:00
|
|
|
})
|
|
|
|
})
|