From 785f1897a42984ece9c6f65829d195d67e331d95 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Aug 2022 11:33:43 +0200 Subject: Add notification plugin hook --- server/tests/fixtures/peertube-plugin-test/main.js | 1 + server/tests/plugins/action-hooks.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js index 8d7584eba..b3febfa12 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js @@ -1,6 +1,7 @@ async function register ({ registerHook, registerSetting, settingsManager, storageManager, peertubeHelpers }) { const actionHooks = [ 'action:application.listening', + 'action:notifier.notification.created', 'action:api.video.updated', 'action:api.video.deleted', diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 209db95a4..405f81d7c 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts @@ -17,8 +17,8 @@ describe('Test plugin action hooks', function () { let videoUUID: string let threadId: number - function checkHook (hook: ServerHookName) { - return servers[0].servers.waitUntilLog('Run hook ' + hook) + function checkHook (hook: ServerHookName, strictCount = true) { + return servers[0].servers.waitUntilLog('Run hook ' + hook, 1, strictCount) } before(async function () { @@ -225,6 +225,13 @@ describe('Test plugin action hooks', function () { }) }) + describe('Notification hook', function () { + + it('Should run action:notifier.notification.created', async function () { + await checkHook('action:notifier.notification.created', false) + }) + }) + after(async function () { await cleanupTests(servers) }) -- cgit v1.2.3