Files
Genarrative/apps/ai-game-creator-shell/tests/pluginHost.test.ts
T
suzmii 16c905b51b
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 7m21s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 7m27s
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 7m28s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 7m46s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m53s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 3m14s
Project CI / Backend tests (pull_request) Successful in 8m6s
Project CI / Native shell tests (pull_request) Successful in 8m11s
Project CI / Repository checks (pull_request) Successful in 5m57s
Project CI / Frontend tests (pull_request) Successful in 7m53s
Project CI / AI game creator shell web tests (pull_request) Successful in 4m38s
修复发布目标与插件能力门禁并同步版本0.1.67
统一显式目标对应的版本读取、构建渠道、产物目录和更新清单
无原生适配器时隐藏Cocos插件并阻止自动启动
同步单架构更新规范并增加发布和插件回归测试
更新版本与锁文件到0.1.67并记录Mac安装包验证结果
2026-09-18 12:15:00 +08:00

64 lines
1.7 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from 'vitest';
import { startAvailableAgcPlugin } from '../src/services/pluginHost';
afterEach(() => vi.unstubAllGlobals());
describe('插件自动启动使用后端能力投影', () => {
it.each(
[
[],
[
{
id: 'agc-cocos-editor',
enabled: false,
hasRuntime: true,
status: 'stopped',
},
],
[
{
id: 'agc-cocos-editor',
enabled: true,
hasRuntime: false,
status: 'package',
},
],
[
{
id: 'agc-cocos-editor',
enabled: true,
hasRuntime: true,
status: 'invalid',
},
],
].map((plugins) => ({ plugins })),
)('隐藏、禁用或不可执行的插件不启动(%j)', async ({ plugins }) => {
const invoke = vi.fn(async () => plugins);
vi.stubGlobal('window', { __TAURI__: { core: { invoke } } });
await startAvailableAgcPlugin('agc-cocos-editor');
expect(invoke).toHaveBeenCalledTimes(1);
expect(invoke).toHaveBeenCalledWith('list_agc_plugins');
});
it('支持的 Cocos 插件继续按原入口启动', async () => {
const invoke = vi.fn(async (command: string) =>
command === 'list_agc_plugins'
? [
{
id: 'agc-cocos-editor',
enabled: true,
hasRuntime: true,
status: 'stopped',
},
]
: {},
);
vi.stubGlobal('window', { __TAURI__: { core: { invoke } } });
await startAvailableAgcPlugin('agc-cocos-editor');
expect(invoke).toHaveBeenLastCalledWith('start_agc_plugin', {
id: 'agc-cocos-editor',
});
});
});