Skip to content

Commit

Permalink
test: 添加 FHomePlugin 插件测试
Browse files Browse the repository at this point in the history
test: 修改 FBaseSwitchPlugin 插件测试
  • Loading branch information
wonder-light committed Mar 31, 2024
1 parent 78a283d commit fc8404f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/jest/plugin.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ULive2dController } from '../../lib/controller/index.js';
import { DMessage } from '../../lib/models/index.js';
import { FBasePlugin, FBaseSwitchPlugin, FCapturePlugin, FConsoleMessagePlugin, FCopyMessagePlugin, FDragPlugin, FHourMessagePlugin, FInfoPlugin, FMotionMessagePlugin, FNullMessagePlugin, FQuitPlugin, FSeasonsMessagePlugin, FSwitchModulePlugin, FSwitchTexturePlugin, FTalkMessagePlugin, FTipsDragPlugin, FVisibilityMessagePlugin } from '../../lib/plugins/index.js';
import { FBasePlugin, FBaseSwitchPlugin, FCapturePlugin, FConsoleMessagePlugin, FCopyMessagePlugin, FDragPlugin, FHomePlugin, FHourMessagePlugin, FInfoPlugin, FMotionMessagePlugin, FNullMessagePlugin, FQuitPlugin, FSeasonsMessagePlugin, FSwitchModulePlugin, FSwitchTexturePlugin, FTalkMessagePlugin, FTipsDragPlugin, FVisibilityMessagePlugin } from '../../lib/plugins/index.js';
import { EEvent, FHelp } from '../../lib/utils/index.js';
import { createLive2d } from './__mocks__/live2d.js';
import val from './__mocks__/variable.js';
Expand Down Expand Up @@ -73,6 +73,13 @@ describe('plugins 测试', () => {
jest.runAllTimers();
});

test('测试 FHomePlugin', () => {
const baseEnable = jest.spyOn(FHomePlugin.prototype, 'isEnable', null).mockImplementation(() => enable);
let plugin = new FHomePlugin;
expect(() => testPlugin(plugin, baseEnable)).not.toThrow();
expect(() => plugin.backToHome()).not.toThrow();
});

test.each([
{ classes: FDragPlugin, name: 'FDragPlugin' },
{ classes: FTipsDragPlugin, name: 'FTipsDragPlugin' }
Expand Down Expand Up @@ -153,6 +160,9 @@ describe('plugins 测试', () => {
// 服装
plugin = new FSwitchTexturePlugin;
await expect(swi(plugin)).resolves.not.toThrow();
// 基础
plugin = new FBaseSwitchPlugin;
await expect(swi(plugin)).resolves.not.toThrow();
});

test.each([
Expand Down

0 comments on commit fc8404f

Please sign in to comment.