1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
4 import * as chai from 'chai'
11 setAccessTokensToServers
12 } from '../../../shared/extra-utils'
14 const expect = chai.expect
16 describe('Test plugins HTML injection', function () {
17 let server: PeerTubeServer = null
18 let command: PluginsCommand
20 before(async function () {
23 server = await createSingleServer(1)
24 await setAccessTokensToServers([ server ])
26 command = server.plugins
29 it('Should not inject global css file in HTML', async function () {
31 const text = await command.getCSS()
32 expect(text).to.be.empty
35 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
36 const res = await makeHTMLRequest(server.url, path)
37 expect(res.text).to.not.include('link rel="stylesheet" href="/plugins/global.css')
41 it('Should install a plugin and a theme', async function () {
44 await command.install({ npmName: 'peertube-plugin-hello-world' })
47 it('Should have the correct global css', async function () {
49 const text = await command.getCSS()
50 expect(text).to.contain('background-color: red')
53 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
54 const res = await makeHTMLRequest(server.url, path)
55 expect(res.text).to.include('link rel="stylesheet" href="/plugins/global.css')
59 it('Should have an empty global css on uninstall', async function () {
60 await command.uninstall({ npmName: 'peertube-plugin-hello-world' })
63 const text = await command.getCSS()
64 expect(text).to.be.empty
67 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
68 const res = await makeHTMLRequest(server.url, path)
69 expect(res.text).to.not.include('link rel="stylesheet" href="/plugins/global.css')
73 after(async function () {
74 await cleanupTests([ server ])