aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-11-14 14:49:50 +0100
committerChocobozzz <me@florianbigard.com>2022-11-14 16:21:59 +0100
commitff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1 (patch)
tree31fc991c12ce66e0bcd59a3bc3cd563c15b24690 /server/tests
parenta742347d50234793fceb08034c20e6881a65d544 (diff)
downloadPeerTube-ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1.tar.gz
PeerTube-ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1.tar.zst
PeerTube-ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1.zip
Add ability to install alpha/beta/rc plugin
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/cli/peertube.ts21
-rw-r--r--server/tests/helpers/index.ts1
-rw-r--r--server/tests/helpers/validator.ts32
3 files changed, 53 insertions, 1 deletions
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index 9b17cdd1b..a39bcfebe 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -24,7 +24,13 @@ describe('Test CLI wrapper', function () {
24 before(async function () { 24 before(async function () {
25 this.timeout(30000) 25 this.timeout(30000)
26 26
27 server = await createSingleServer(1) 27 server = await createSingleServer(1, {
28 rates_limit: {
29 login: {
30 max: 30
31 }
32 }
33 })
28 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
29 35
30 await server.users.create({ username: 'user_1', password: 'super_password' }) 36 await server.users.create({ username: 'user_1', password: 'super_password' })
@@ -240,6 +246,19 @@ describe('Test CLI wrapper', function () {
240 246
241 expect(res).to.not.contain('peertube-plugin-hello-world') 247 expect(res).to.not.contain('peertube-plugin-hello-world')
242 }) 248 })
249
250 it('Should install a plugin in requested beta version', async function () {
251 this.timeout(60000)
252
253 await cliCommand.execWithEnv(`${cmd} plugins install --npm-name peertube-plugin-hello-world --plugin-version 0.0.21-beta.1`)
254
255 const res = await cliCommand.execWithEnv(`${cmd} plugins list`)
256
257 expect(res).to.contain('peertube-plugin-hello-world')
258 expect(res).to.contain('0.0.21-beta.1')
259
260 await cliCommand.execWithEnv(`${cmd} plugins uninstall --npm-name peertube-plugin-hello-world`)
261 })
243 }) 262 })
244 263
245 describe('Manage video redundancies', function () { 264 describe('Manage video redundancies', function () {
diff --git a/server/tests/helpers/index.ts b/server/tests/helpers/index.ts
index 1f0e3098a..1b5c6d15b 100644
--- a/server/tests/helpers/index.ts
+++ b/server/tests/helpers/index.ts
@@ -5,3 +5,4 @@ import './dns'
5import './image' 5import './image'
6import './markdown' 6import './markdown'
7import './request' 7import './request'
8import './validator'
diff --git a/server/tests/helpers/validator.ts b/server/tests/helpers/validator.ts
new file mode 100644
index 000000000..f40a3aaae
--- /dev/null
+++ b/server/tests/helpers/validator.ts
@@ -0,0 +1,32 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import { expect } from 'chai'
4import { isPluginStableOrUnstableVersionValid, isPluginStableVersionValid } from '@server/helpers/custom-validators/plugins'
5
6describe('Validators', function () {
7
8 it('Should correctly check stable plugin versions', async function () {
9 expect(isPluginStableVersionValid('3.4.0')).to.be.true
10 expect(isPluginStableVersionValid('0.4.0')).to.be.true
11 expect(isPluginStableVersionValid('0.1.0')).to.be.true
12
13 expect(isPluginStableVersionValid('0.1.0-beta-1')).to.be.false
14 expect(isPluginStableVersionValid('hello')).to.be.false
15 expect(isPluginStableVersionValid('0.x.a')).to.be.false
16 })
17
18 it('Should correctly check unstable plugin versions', async function () {
19 expect(isPluginStableOrUnstableVersionValid('3.4.0')).to.be.true
20 expect(isPluginStableOrUnstableVersionValid('0.4.0')).to.be.true
21 expect(isPluginStableOrUnstableVersionValid('0.1.0')).to.be.true
22
23 expect(isPluginStableOrUnstableVersionValid('0.1.0-beta.1')).to.be.true
24 expect(isPluginStableOrUnstableVersionValid('0.1.0-alpha.45')).to.be.true
25 expect(isPluginStableOrUnstableVersionValid('0.1.0-rc.45')).to.be.true
26
27 expect(isPluginStableOrUnstableVersionValid('hello')).to.be.false
28 expect(isPluginStableOrUnstableVersionValid('0.x.a')).to.be.false
29 expect(isPluginStableOrUnstableVersionValid('0.1.0-rc-45')).to.be.false
30 expect(isPluginStableOrUnstableVersionValid('0.1.0-rc.45d')).to.be.false
31 })
32})