aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-09 11:00:30 +0200
committerChocobozzz <me@florianbigard.com>2020-04-09 11:00:30 +0200
commit1b05d82d861f42c27766e9f24d8d55e68b0cf098 (patch)
treebbf14abc606dd3f8f0c13625afbdf3b17fea3a23 /server/tests/plugins
parentbc0d801bb7a0cc503c1637f4a07bb51d68d85608 (diff)
downloadPeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.tar.gz
PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.tar.zst
PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.zip
Add SQL query support in plugins
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/index.ts1
-rw-r--r--server/tests/plugins/plugin-helpers.ts38
2 files changed, 39 insertions, 0 deletions
diff --git a/server/tests/plugins/index.ts b/server/tests/plugins/index.ts
index f41708055..9c9499a79 100644
--- a/server/tests/plugins/index.ts
+++ b/server/tests/plugins/index.ts
@@ -2,3 +2,4 @@ import './action-hooks'
2import './filter-hooks' 2import './filter-hooks'
3import './translations' 3import './translations'
4import './video-constants' 4import './video-constants'
5import './plugin-helpers'
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
new file mode 100644
index 000000000..05928273f
--- /dev/null
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -0,0 +1,38 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import * as chai from 'chai'
4import 'mocha'
5import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers'
6import { getPluginTestPath, installPlugin, setAccessTokensToServers } from '../../../shared/extra-utils'
7
8const expect = chai.expect
9
10describe('Test plugin helpers', function () {
11 let server: ServerInfo
12
13 before(async function () {
14 this.timeout(30000)
15
16 server = await flushAndRunServer(1)
17 await setAccessTokensToServers([ server ])
18
19 await installPlugin({
20 url: server.url,
21 accessToken: server.accessToken,
22 path: getPluginTestPath('-four')
23 })
24 })
25
26 it('Should have logged things', async function () {
27 await waitUntilLog(server, 'localhost:' + server.port + ' peertube-plugin-test-four', 1, false)
28 await waitUntilLog(server, 'Hello world from plugin four', 1)
29 })
30
31 it('Should have made a query', async function () {
32 await waitUntilLog(server, `root email is admin${server.internalServerNumber}@example.com`, 1)
33 })
34
35 after(async function () {
36 await cleanupTests([ server ])
37 })
38})