1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
4 import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'
10 setAccessTokensToServers, uninstallPlugin
11 } from '../../../shared/extra-utils'
12 import { expect } from 'chai'
14 describe('Test plugin helpers', function () {
15 let server: ServerInfo
17 '/plugins/test-five/router/',
18 '/plugins/test-five/0.0.1/router/'
21 before(async function () {
24 server = await flushAndRunServer(1)
25 await setAccessTokensToServers([ server ])
29 accessToken: server.accessToken,
30 path: getPluginTestPath('-five')
34 it('Should answer "pong"', async function () {
35 for (const path of basePaths) {
36 const res = await makeGetRequest({
39 statusCodeExpected: 200
42 expect(res.body.message).to.equal('pong')
46 it('Should mirror post body', async function () {
53 for (const path of basePaths) {
54 const res = await makePostBodyRequest({
56 path: path + 'form/post/mirror',
58 statusCodeExpected: 200
61 expect(res.body).to.deep.equal(body)
65 it('Should remove the plugin and remove the routes', async function () {
66 await uninstallPlugin({
68 accessToken: server.accessToken,
69 npmName: 'peertube-plugin-test-five'
72 for (const path of basePaths) {
73 await makeGetRequest({
76 statusCodeExpected: 404
79 await makePostBodyRequest({
83 statusCodeExpected: 404
88 after(async function () {
89 await cleanupTests([ server ])