From 01956af43a79ea95b034b39f06f4a22264e96852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 22 Apr 2021 11:35:36 -0400 Subject: [PATCH] feat: remove sync hooks support --- src/plugins/hooks.js | 4 ---- test/plugins.js | 7 +------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js index d3dec5965d..394c11c5b8 100644 --- a/src/plugins/hooks.js +++ b/src/plugins/hooks.js @@ -137,10 +137,6 @@ async function fireFilterHook(hook, hookList, params) { payload => resolve(payload), err => reject(err) ); - return; - } - if (returned) { - resolve(returned); } }); } diff --git a/test/plugins.js b/test/plugins.js index b7b5575d28..4bc48af007 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -47,7 +47,7 @@ describe('Plugins', () => { }); }); - it('should register and fire a filter hook having 3 methods, one returning a promise, one calling the callback and one just returning', async () => { + it('should register and fire a filter hook having 2 methods, one returning a promise, one calling the callback', async () => { function method1(data, callback) { data.foo += 1; callback(null, data); @@ -58,14 +58,9 @@ describe('Plugins', () => { resolve(data); }); } - function method3(data) { - data.foo += 1; - return data; - } plugins.hooks.register('test-plugin', { hook: 'filter:test.hook2', method: method1 }); plugins.hooks.register('test-plugin', { hook: 'filter:test.hook2', method: method2 }); - plugins.hooks.register('test-plugin', { hook: 'filter:test.hook2', method: method3 }); const data = await plugins.hooks.fire('filter:test.hook2', { foo: 1 }); assert.strictEqual(data.foo, 8);