Files
Genarrative/src/services/frontendRuntimeConfigService.test.ts
T
kdletters bbbd91db88
Project CI / AI game creator shell Rust crates (push) Successful in 1m34s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m54s
Project CI / Backend tests (push) Successful in 4m9s
Project CI / Frontend tests (push) Successful in 2m6s
Project CI / Native shell tests (push) Successful in 6m22s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m32s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 9m31s
Project CI / AI game creator shell web tests (push) Successful in 1m37s
Project CI / Repository checks (push) Successful in 2m17s
补齐游戏分发网页发布链路并修掉发布灰度按匿名判定
- 新增 scripts/check-game-distribution-web-publish-e2e.mjs:网页登录、选封面、选发行包 ZIP、填资料提交,待审不可见、审核后公开、更新沿用同一 gameId 且旧版在线,共 12 项 PASS
- frontendRuntimeConfigService 去掉 skipAuth:发布灰度按作者判定,匿名请求恒为 false,之前只要显式配置过灰度网页端就永远没有发布入口;单测同步更新
- 游戏分发里程碑阶段 C 第 4 条改为已勾选,第 5 条缺口收窄到上传中断/双击/登录失效/窗口关闭与换账号
- pitfalls 记录「按用户灰度配置不能走 skipAuth」的经验
2026-09-28 20:21:34 +08:00

44 lines
1.1 KiB
TypeScript

import { beforeEach, describe, expect, it, vi } from 'vitest';
const apiClientMocks = vi.hoisted(() => ({
requestJson: vi.fn(),
}));
vi.mock('./apiClient', async () => {
const actual =
await vi.importActual<typeof import('./apiClient')>('./apiClient');
return {
...actual,
requestJson: apiClientMocks.requestJson,
};
});
import { loadFrontendRuntimeConfig } from './frontendRuntimeConfigService';
describe('frontendRuntimeConfigService', () => {
beforeEach(() => {
vi.clearAllMocks();
apiClientMocks.requestJson.mockResolvedValue({
imageEditorAgentSidebarEnabled: false,
});
});
it('loads frontend runtime config with local auth impact', async () => {
await expect(loadFrontendRuntimeConfig()).resolves.toEqual({
imageEditorAgentSidebarEnabled: false,
});
expect(apiClientMocks.requestJson).toHaveBeenCalledWith(
'/api/runtime/frontend-config',
{ method: 'GET' },
'读取前端运行时配置失败',
{
authImpact: 'local',
skipRefresh: true,
notifyAuthStateChange: false,
clearAuthOnUnauthorized: false,
},
);
});
});