1e62d8317a
- 活动回合事实源统一到 Direct 线程管理器:删除 direct_runtime 的第二份快照,接单、进度内容变化与收口各广播一次活动回合变更事件
- 平台维护态判定移入 Rust 并在渲染层只订阅单一事件:新增 platform_maintenance 模块与各平台 facade 错误分支的分类入口
- 封面生成请求补 generationInputs.source,保持队列回填后仍能拿到平台素材 ID
- 渲染层按 master 5398a53e6 退役诊断详情入口:删除 agentRuntimeErrorDetail 与「查看详情」交互及其专属用例
- 冲突收口:nginx SPA 白名单、.gitignore、mobile 检查脚本、capabilities 描述取上游,两个已退役计划随上游删除,文档保留双方条目
- 新增并回写本里程碑取证、decision-log 与 pitfalls 的 2026-09-28 记录
69 lines
2.1 KiB
TypeScript
69 lines
2.1 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { act, cleanup, render, screen, waitFor } from '@testing-library/react';
|
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
|
|
import { MaintenanceNotice } from '../src/components/modal/MaintenanceNotice';
|
|
import { CLIENT_MAINTENANCE_EVENT } from '../src/services/clientMaintenance';
|
|
import { createTauriEventFake, type TauriEventFake } from './tauriEventFake';
|
|
|
|
let eventFake: TauriEventFake | null = null;
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
eventFake?.restore();
|
|
eventFake = null;
|
|
});
|
|
|
|
describe('客户端维护大弹窗', () => {
|
|
it('收到 Rust 侧维护广播时统一展示大弹窗', async () => {
|
|
eventFake = createTauriEventFake();
|
|
eventFake.install();
|
|
render(<MaintenanceNotice />);
|
|
|
|
await waitFor(() =>
|
|
expect(eventFake?.listenInvokeCounts.get(CLIENT_MAINTENANCE_EVENT)).toBe(
|
|
1,
|
|
),
|
|
);
|
|
eventFake.flushRegistrationEvals();
|
|
expect(screen.queryByRole('dialog', { name: '系统维护中' })).toBeNull();
|
|
|
|
act(() => {
|
|
eventFake?.emit(CLIENT_MAINTENANCE_EVENT, {
|
|
code: 'MAINTENANCE',
|
|
status: 503,
|
|
});
|
|
});
|
|
|
|
expect(screen.getByRole('dialog', { name: '系统维护中' })).toBeTruthy();
|
|
expect(
|
|
screen.getByText('服务正在维护,当前操作暂时无法完成。请稍后再试。'),
|
|
).toBeTruthy();
|
|
expect(screen.getByRole('button', { name: '我知道了' })).toBeTruthy();
|
|
});
|
|
|
|
it('普通业务错误不会弹维护窗,卸载后不保留订阅', async () => {
|
|
eventFake = createTauriEventFake();
|
|
eventFake.install();
|
|
const view = render(<MaintenanceNotice />);
|
|
|
|
await waitFor(() =>
|
|
expect(eventFake?.listenInvokeCounts.get(CLIENT_MAINTENANCE_EVENT)).toBe(
|
|
1,
|
|
),
|
|
);
|
|
eventFake.flushRegistrationEvals();
|
|
|
|
act(() => {
|
|
eventFake?.emit('game-creator-agent-runtime-update', { revision: 1 });
|
|
});
|
|
expect(screen.queryByRole('dialog', { name: '系统维护中' })).toBeNull();
|
|
|
|
view.unmount();
|
|
expect(eventFake.unlistenInvokeCounts.get(CLIENT_MAINTENANCE_EVENT)).toBe(
|
|
1,
|
|
);
|
|
expect(eventFake.jsCallbackCount()).toBe(0);
|
|
});
|
|
});
|