diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-14 14:49:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-14 16:21:59 +0100 |
commit | ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1 (patch) | |
tree | 31fc991c12ce66e0bcd59a3bc3cd563c15b24690 /server/tests/helpers/validator.ts | |
parent | a742347d50234793fceb08034c20e6881a65d544 (diff) | |
download | PeerTube-ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1.tar.gz PeerTube-ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1.tar.zst PeerTube-ff91b644fb1b063d0a8eff7492beb1a9bf7e4ce1.zip |
Add ability to install alpha/beta/rc plugin
Diffstat (limited to 'server/tests/helpers/validator.ts')
-rw-r--r-- | server/tests/helpers/validator.ts | 32 |
1 files changed, 32 insertions, 0 deletions
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 | |||
3 | import { expect } from 'chai' | ||
4 | import { isPluginStableOrUnstableVersionValid, isPluginStableVersionValid } from '@server/helpers/custom-validators/plugins' | ||
5 | |||
6 | describe('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 | }) | ||