1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
4 import { expect } from 'chai'
12 setAccessTokensToServers
13 } from '../../../shared/extra-utils'
15 describe('Test plugin scripts', function () {
16 let server: ServerInfo
18 before(async function () {
21 server = await flushAndRunServer(1)
22 await setAccessTokensToServers([ server ])
25 it('Should install a plugin from stateless CLI', async function () {
28 const packagePath = PluginsCommand.getPluginTestPath()
30 await server.cli.execWithEnv(`npm run plugin:install -- --plugin-path ${packagePath}`)
33 it('Should install a theme from stateless CLI', async function () {
36 await server.cli.execWithEnv(`npm run plugin:install -- --npm-name peertube-theme-background-red`)
39 it('Should have the theme and the plugin registered when we restart peertube', async function () {
42 await killallServers([ server ])
43 await reRunServer(server)
45 const config = await server.config.getConfig()
47 const plugin = config.plugin.registered
48 .find(p => p.name === 'test')
49 expect(plugin).to.not.be.undefined
51 const theme = config.theme.registered
52 .find(t => t.name === 'background-red')
53 expect(theme).to.not.be.undefined
56 it('Should uninstall a plugin from stateless CLI', async function () {
59 await server.cli.execWithEnv(`npm run plugin:uninstall -- --npm-name peertube-plugin-test`)
62 it('Should have removed the plugin on another peertube restart', async function () {
65 await killallServers([ server ])
66 await reRunServer(server)
68 const config = await server.config.getConfig()
70 const plugin = config.plugin.registered
71 .find(p => p.name === 'test')
72 expect(plugin).to.be.undefined
75 after(async function () {
76 await cleanupTests([ server ])