diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:44:28 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:44:28 +0200 |
commit | 2b9f672b58bc2c13c96ee79f522003979e4bfc02 (patch) | |
tree | 898e170d1b8f5b9624ec7bb21c5212c4ea1bbc2c | |
parent | dc3d902234bb73fbc8cf9787e3036f2012526e6c (diff) | |
download | PeerTube-2b9f672b58bc2c13c96ee79f522003979e4bfc02.tar.gz PeerTube-2b9f672b58bc2c13c96ee79f522003979e4bfc02.tar.zst PeerTube-2b9f672b58bc2c13c96ee79f522003979e4bfc02.zip |
Improve plugin constant tests
-rwxr-xr-x | scripts/ci.sh | 3 | ||||
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-video-constants/main.js | 12 | ||||
-rw-r--r-- | server/tests/index.ts | 1 | ||||
-rw-r--r-- | server/tests/lib/index.ts | 1 | ||||
-rw-r--r-- | server/tests/lib/video-constant-registry-factory.ts (renamed from server/tests/lib/plugins/video-constant-registry-factory.test.ts) | 0 |
5 files changed, 11 insertions, 6 deletions
diff --git a/scripts/ci.sh b/scripts/ci.sh index 07e37e0ee..7862888b8 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh | |||
@@ -47,11 +47,12 @@ if [ "$1" = "client" ]; then | |||
47 | 47 | ||
48 | feedsFiles=$(findTestFiles ./dist/server/tests/feeds) | 48 | feedsFiles=$(findTestFiles ./dist/server/tests/feeds) |
49 | helperFiles=$(findTestFiles ./dist/server/tests/helpers) | 49 | helperFiles=$(findTestFiles ./dist/server/tests/helpers) |
50 | libFiles=$(findTestFiles ./dist/server/tests/lib) | ||
50 | miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js" | 51 | miscFiles="./dist/server/tests/client.js ./dist/server/tests/misc-endpoints.js" |
51 | # Not in plugin task, it needs an index.html | 52 | # Not in plugin task, it needs an index.html |
52 | pluginFiles="./dist/server/tests/plugins/html-injection.js" | 53 | pluginFiles="./dist/server/tests/plugins/html-injection.js" |
53 | 54 | ||
54 | MOCHA_PARALLEL=true runTest "$1" 2 $feedsFiles $helperFiles $miscFiles $pluginFiles | 55 | MOCHA_PARALLEL=true runTest "$1" 2 $feedsFiles $helperFiles $miscFiles $pluginFiles $libFiles |
55 | elif [ "$1" = "cli-plugin" ]; then | 56 | elif [ "$1" = "cli-plugin" ]; then |
56 | npm run build:server | 57 | npm run build:server |
57 | npm run setup:cli | 58 | npm run setup:cli |
diff --git a/server/tests/fixtures/peertube-plugin-test-video-constants/main.js b/server/tests/fixtures/peertube-plugin-test-video-constants/main.js index f44704a44..06527bd35 100644 --- a/server/tests/fixtures/peertube-plugin-test-video-constants/main.js +++ b/server/tests/fixtures/peertube-plugin-test-video-constants/main.js | |||
@@ -7,24 +7,26 @@ async function register ({ | |||
7 | getRouter | 7 | getRouter |
8 | }) { | 8 | }) { |
9 | videoLanguageManager.addConstant('al_bhed', 'Al Bhed') | 9 | videoLanguageManager.addConstant('al_bhed', 'Al Bhed') |
10 | videoLanguageManager.addConstant('al_bhed2', 'Al Bhed 2') | 10 | videoLanguageManager.addLanguage('al_bhed2', 'Al Bhed 2') |
11 | videoLanguageManager.addConstant('al_bhed3', 'Al Bhed 3') | 11 | videoLanguageManager.addConstant('al_bhed3', 'Al Bhed 3') |
12 | videoLanguageManager.deleteConstant('en') | 12 | videoLanguageManager.deleteConstant('en') |
13 | videoLanguageManager.deleteConstant('fr') | 13 | videoLanguageManager.deleteLanguage('fr') |
14 | videoLanguageManager.deleteConstant('al_bhed3') | 14 | videoLanguageManager.deleteConstant('al_bhed3') |
15 | 15 | ||
16 | videoCategoryManager.addConstant(42, 'Best category') | 16 | videoCategoryManager.addCategory(42, 'Best category') |
17 | videoCategoryManager.addConstant(43, 'High best category') | 17 | videoCategoryManager.addConstant(43, 'High best category') |
18 | videoCategoryManager.deleteConstant(1) // Music | 18 | videoCategoryManager.deleteConstant(1) // Music |
19 | videoCategoryManager.deleteConstant(2) // Films | 19 | videoCategoryManager.deleteCategory(2) // Films |
20 | 20 | ||
21 | videoLicenceManager.addConstant(42, 'Best licence') | 21 | videoLicenceManager.addLicence(42, 'Best licence') |
22 | videoLicenceManager.addConstant(43, 'High best licence') | 22 | videoLicenceManager.addConstant(43, 'High best licence') |
23 | videoLicenceManager.deleteConstant(1) // Attribution | 23 | videoLicenceManager.deleteConstant(1) // Attribution |
24 | videoLicenceManager.deleteConstant(7) // Public domain | 24 | videoLicenceManager.deleteConstant(7) // Public domain |
25 | 25 | ||
26 | videoPrivacyManager.deleteConstant(2) | 26 | videoPrivacyManager.deleteConstant(2) |
27 | videoPrivacyManager.deletePrivacy(2) | ||
27 | playlistPrivacyManager.deleteConstant(3) | 28 | playlistPrivacyManager.deleteConstant(3) |
29 | playlistPrivacyManager.deletePlaylistPrivacy(3) | ||
28 | 30 | ||
29 | { | 31 | { |
30 | const router = getRouter() | 32 | const router = getRouter() |
diff --git a/server/tests/index.ts b/server/tests/index.ts index 3fbd0ebbd..1718ac424 100644 --- a/server/tests/index.ts +++ b/server/tests/index.ts | |||
@@ -6,3 +6,4 @@ import './cli/' | |||
6 | import './api/' | 6 | import './api/' |
7 | import './plugins/' | 7 | import './plugins/' |
8 | import './helpers/' | 8 | import './helpers/' |
9 | import './lib/' | ||
diff --git a/server/tests/lib/index.ts b/server/tests/lib/index.ts new file mode 100644 index 000000000..a40df35fd --- /dev/null +++ b/server/tests/lib/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './video-constant-registry-factory' | |||
diff --git a/server/tests/lib/plugins/video-constant-registry-factory.test.ts b/server/tests/lib/video-constant-registry-factory.ts index e26b286e1..e26b286e1 100644 --- a/server/tests/lib/plugins/video-constant-registry-factory.test.ts +++ b/server/tests/lib/video-constant-registry-factory.ts | |||