aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/plugin-helpers.ts
blob: 05928273f2b94722f08d5fdf5edbb7e82798cf6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */

import * as chai from 'chai'
import 'mocha'
import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers'
import { getPluginTestPath, installPlugin, setAccessTokensToServers } from '../../../shared/extra-utils'

const expect = chai.expect

describe('Test plugin helpers', function () {
  let server: ServerInfo

  before(async function () {
    this.timeout(30000)

    server = await flushAndRunServer(1)
    await setAccessTokensToServers([ server ])

    await installPlugin({
      url: server.url,
      accessToken: server.accessToken,
      path: getPluginTestPath('-four')
    })
  })

  it('Should have logged things', async function () {
    await waitUntilLog(server, 'localhost:' + server.port + ' peertube-plugin-test-four', 1, false)
    await waitUntilLog(server, 'Hello world from plugin four', 1)
  })

  it('Should have made a query', async function () {
    await waitUntilLog(server, `root email is admin${server.internalServerNumber}@example.com`, 1)
  })

  after(async function () {
    await cleanupTests([ server ])
  })
})