From b43f3120be4e3d3e61fa230933c07235090f5cc1 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 25 May 2026 15:00:13 +0400 Subject: [PATCH] Update old plugin manager tests --- .../core/test/specs/plugin_manager/index.js | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/core/test/specs/plugin_manager/index.js b/packages/core/test/specs/plugin_manager/index.js index ae5940232..2c6396df5 100644 --- a/packages/core/test/specs/plugin_manager/index.js +++ b/packages/core/test/specs/plugin_manager/index.js @@ -1,18 +1,23 @@ -import PluginManager from 'plugin_manager'; +import { setupTestEditor } from '../../common'; describe('PluginManager', () => { describe('Main', () => { - var obj; - var val; - var testPlugin = (e) => { - val = e; + let editor; + let obj; + let val; + const testPlugin = (ed) => { + val = ed; }; beforeEach(() => { - obj = new PluginManager(); + val = null; + ({ editor } = setupTestEditor()); + obj = editor.Plugins; }); afterEach(() => { + editor?.destroy(); + editor = null; obj = null; }); @@ -21,19 +26,17 @@ describe('PluginManager', () => { }); test('No plugins inside', () => { - expect(obj.getAll()).toEqual({}); + expect(obj.getAll()).toEqual([]); }); test('Add new plugin', () => { - obj.add('test', testPlugin); + obj.add({ id: 'test', plugin: testPlugin }); expect(obj.get('test')).toBeTruthy(); }); test('Added plugin is working', () => { - obj.add('test', testPlugin); - var plugin = obj.get('test'); - plugin('tval'); - expect(val).toEqual('tval'); + obj.add({ id: 'test', plugin: testPlugin }); + expect(val).toBe(editor); }); }); });