diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-19 17:30:41 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 89cd12756035a146bbcc4db78cd3cd64f2f3d88d (patch) | |
tree | 896cd9fca1e0baa969b1f7a5b398ec1602761661 /server/tests/fixtures/peertube-plugin-test-two/main.js | |
parent | 09071200c73f5358e1d0bfb61a274e4f2c4ec52b (diff) | |
download | PeerTube-89cd12756035a146bbcc4db78cd3cd64f2f3d88d.tar.gz PeerTube-89cd12756035a146bbcc4db78cd3cd64f2f3d88d.tar.zst PeerTube-89cd12756035a146bbcc4db78cd3cd64f2f3d88d.zip |
Add hook filters tests
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test-two/main.js')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-two/main.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-two/main.js b/server/tests/fixtures/peertube-plugin-test-two/main.js new file mode 100644 index 000000000..71c11b2ba --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-two/main.js | |||
@@ -0,0 +1,21 @@ | |||
1 | async function register ({ registerHook, registerSetting, settingsManager, storageManager, peertubeHelpers }) { | ||
2 | registerHook({ | ||
3 | target: 'filter:api.videos.list.params', | ||
4 | handler: obj => addToCount(obj) | ||
5 | }) | ||
6 | } | ||
7 | |||
8 | async function unregister () { | ||
9 | return | ||
10 | } | ||
11 | |||
12 | module.exports = { | ||
13 | register, | ||
14 | unregister | ||
15 | } | ||
16 | |||
17 | // ############################################################################ | ||
18 | |||
19 | function addToCount (obj) { | ||
20 | return Object.assign({}, obj, { count: obj.count + 1 }) | ||
21 | } | ||