mirror of
https://github.com/coder/code-server.git
synced 2025-07-28 12:33:43 +08:00
plugin: Add basic loading test
Will work on testing overlay next.
This commit is contained in:
31
test/plugin.test.ts
Normal file
31
test/plugin.test.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { describe } from "mocha"
|
||||
import { PluginAPI } from "../src/node/plugin"
|
||||
import { logger } from "@coder/logger"
|
||||
import * as path from "path"
|
||||
import * as assert from "assert"
|
||||
|
||||
/**
|
||||
* 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()
|
||||
|
||||
// We remove the function fields from the application's plugins.
|
||||
const apps = JSON.parse(JSON.stringify(await papi.applications()))
|
||||
|
||||
assert.deepEqual([
|
||||
{
|
||||
name: "goland",
|
||||
version: "4.0.0",
|
||||
iconPath: "icon.svg",
|
||||
plugin: {
|
||||
name: "test-plugin",
|
||||
version: "1.0.0",
|
||||
description: "Fake plugin for testing code-server's plugin API",
|
||||
},
|
||||
},
|
||||
], apps)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user