diff options
Diffstat (limited to 'server/tests/fixtures')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test/main.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js index 322c0610c..e5a9f8df5 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js | |||
@@ -40,6 +40,26 @@ async function register ({ registerHook, registerSetting, settingsManager, stora | |||
40 | }) | 40 | }) |
41 | 41 | ||
42 | registerHook({ | 42 | registerHook({ |
43 | target: 'filter:api.accounts.videos.list.params', | ||
44 | handler: obj => addToCount(obj) | ||
45 | }) | ||
46 | |||
47 | registerHook({ | ||
48 | target: 'filter:api.accounts.videos.list.result', | ||
49 | handler: obj => addToTotal(obj, 2) | ||
50 | }) | ||
51 | |||
52 | registerHook({ | ||
53 | target: 'filter:api.video-channels.videos.list.params', | ||
54 | handler: obj => addToCount(obj, 3) | ||
55 | }) | ||
56 | |||
57 | registerHook({ | ||
58 | target: 'filter:api.video-channels.videos.list.result', | ||
59 | handler: obj => addToTotal(obj, 3) | ||
60 | }) | ||
61 | |||
62 | registerHook({ | ||
43 | target: 'filter:api.video.get.result', | 63 | target: 'filter:api.video.get.result', |
44 | handler: video => { | 64 | handler: video => { |
45 | video.name += ' <3' | 65 | video.name += ' <3' |
@@ -167,14 +187,14 @@ module.exports = { | |||
167 | 187 | ||
168 | // ############################################################################ | 188 | // ############################################################################ |
169 | 189 | ||
170 | function addToCount (obj) { | 190 | function addToCount (obj, amount = 1) { |
171 | return Object.assign({}, obj, { count: obj.count + 1 }) | 191 | return Object.assign({}, obj, { count: obj.count + amount }) |
172 | } | 192 | } |
173 | 193 | ||
174 | function addToTotal (result) { | 194 | function addToTotal (result, amount = 1) { |
175 | return { | 195 | return { |
176 | data: result.data, | 196 | data: result.data, |
177 | total: result.total + 1 | 197 | total: result.total + amount |
178 | } | 198 | } |
179 | } | 199 | } |
180 | 200 | ||