1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
4 import { expect } from 'chai'
11 setAccessTokensToServers
12 } from '../../../shared/extra-utils'
14 describe('Test plugin scripts', function () {
15 let server: PeerTubeServer
17 before(async function () {
20 server = await createSingleServer(1)
21 await setAccessTokensToServers([ server ])
24 it('Should install a plugin from stateless CLI', async function () {
27 const packagePath = PluginsCommand.getPluginTestPath()
29 await server.cli.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`)
32 it('Should install a theme from stateless CLI', async function () {
35 await server.cli.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`)
38 it('Should have the theme and the plugin registered when we restart peertube', async function () {
41 await killallServers([ server ])
44 const config = await server.config.getConfig()
46 const plugin = config.plugin.registered
47 .find(p => p.name === 'test')
48 expect(plugin).to.not.be.undefined
50 const theme = config.theme.registered
51 .find(t => t.name === 'background-red')
52 expect(theme).to.not.be.undefined
55 it('Should uninstall a plugin from stateless CLI', async function () {
58 await server.cli.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`)
61 it('Should have removed the plugin on another peertube restart', async function () {
64 await killallServers([ server ])
67 const config = await server.config.getConfig()
69 const plugin = config.plugin.registered
70 .find(p => p.name === 'test')
71 expect(plugin).to.be.undefined
74 after(async function () {
75 await cleanupTests([ server ])