mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
28 lines
1003 B
TypeScript
28 lines
1003 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import {
|
|
CommandControlPlugin,
|
|
CommandInitPlugin,
|
|
EventInitPlugin,
|
|
} from '../../src';
|
|
import { PluginType, controller } from '../../src';
|
|
|
|
describe('create-plugins', () => {
|
|
it('should make proper control plugins', () => {
|
|
const pl2 = CommandControlPlugin(() => controller.next());
|
|
expect(pl2).to.have.all.keys(['type', 'execute']);
|
|
expect(pl2.type).toBe(PluginType.Control);
|
|
expect(pl2.execute).an('function');
|
|
});
|
|
it('should make proper init plugins', () => {
|
|
const pl = EventInitPlugin(() => controller.next());
|
|
expect(pl).to.have.all.keys(['type', 'execute']);
|
|
expect(pl.type).toBe(PluginType.Init);
|
|
expect(pl.execute).an('function');
|
|
|
|
const pl2 = CommandInitPlugin(() => controller.next());
|
|
expect(pl2).to.have.all.keys(['type', 'execute']);
|
|
expect(pl2.type).toBe(PluginType.Init);
|
|
expect(pl2.execute).an('function');
|
|
});
|
|
});
|