Browse Source

Update old plugin manager tests

new-plugin-system
Artur Arseniev 4 months ago
parent
commit
b43f3120be
  1. 27
      packages/core/test/specs/plugin_manager/index.js

27
packages/core/test/specs/plugin_manager/index.js

@ -1,18 +1,23 @@
import PluginManager from 'plugin_manager'; import { setupTestEditor } from '../../common';
describe('PluginManager', () => { describe('PluginManager', () => {
describe('Main', () => { describe('Main', () => {
var obj; let editor;
var val; let obj;
var testPlugin = (e) => { let val;
val = e; const testPlugin = (ed) => {
val = ed;
}; };
beforeEach(() => { beforeEach(() => {
obj = new PluginManager(); val = null;
({ editor } = setupTestEditor());
obj = editor.Plugins;
}); });
afterEach(() => { afterEach(() => {
editor?.destroy();
editor = null;
obj = null; obj = null;
}); });
@ -21,19 +26,17 @@ describe('PluginManager', () => {
}); });
test('No plugins inside', () => { test('No plugins inside', () => {
expect(obj.getAll()).toEqual({}); expect(obj.getAll()).toEqual([]);
}); });
test('Add new plugin', () => { test('Add new plugin', () => {
obj.add('test', testPlugin); obj.add({ id: 'test', plugin: testPlugin });
expect(obj.get('test')).toBeTruthy(); expect(obj.get('test')).toBeTruthy();
}); });
test('Added plugin is working', () => { test('Added plugin is working', () => {
obj.add('test', testPlugin); obj.add({ id: 'test', plugin: testPlugin });
var plugin = obj.get('test'); expect(val).toBe(editor);
plugin('tval');
expect(val).toEqual('tval');
}); });
}); });
}); });

Loading…
Cancel
Save