1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
4 import * as chai from 'chai'
12 setAccessTokensToServers,
14 } from '../../../shared/extra-utils'
16 const expect = chai.expect
18 describe('Test plugins HTML inection', function () {
19 let server: ServerInfo = null
21 before(async function () {
24 server = await flushAndRunServer(1)
25 await setAccessTokensToServers([ server ])
28 it('Should not inject global css file in HTML', async function () {
30 const res = await getPluginsCSS(server.url)
31 expect(res.text).to.be.empty
34 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
35 const res = await makeHTMLRequest(server.url, path)
36 expect(res.text).to.not.include('link rel="stylesheet" href="/plugins/global.css')
40 it('Should install a plugin and a theme', async function () {
45 accessToken: server.accessToken,
46 npmName: 'peertube-plugin-hello-world'
50 it('Should have the correct global css', async function () {
52 const res = await getPluginsCSS(server.url)
53 expect(res.text).to.contain('background-color: red')
56 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
57 const res = await makeHTMLRequest(server.url, path)
58 expect(res.text).to.include('link rel="stylesheet" href="/plugins/global.css')
62 it('Should have an empty global css on uninstall', async function () {
63 await uninstallPlugin({
65 accessToken: server.accessToken,
66 npmName: 'peertube-plugin-hello-world'
70 const res = await getPluginsCSS(server.url)
71 expect(res.text).to.be.empty
74 for (const path of [ '/', '/videos/embed/1', '/video-playlists/embed/1' ]) {
75 const res = await makeHTMLRequest(server.url, path)
76 expect(res.text).to.not.include('link rel="stylesheet" href="/plugins/global.css')
80 after(async function () {
81 await cleanupTests([ server ])