Files
Genarrative/src/services/activeAppTitle.test.ts
T
kdletters 39aed2e486
Project CI / AI game creator shell Rust shard 1/4 (push) Failing after 18s
Project CI / AI game creator shell Rust shard 4/4 (push) Failing after 18s
Project CI / AI game creator shell Rust shard 2/4 (push) Failing after 19s
Project CI / AI game creator shell Rust shard 3/4 (push) Failing after 19s
Project CI / AI game creator shell Rust crates (push) Failing after 18s
Project CI / Native shell tests (push) Failing after 18s
Project CI / Backend tests (push) Failing after 18s
Project CI / AI game creator shell Rust smoke (push) Failing after 19s
Project CI / Frontend tests (push) Failing after 7s
Project CI / AI game creator shell web tests (push) Failing after 11s
Project CI / Repository checks (push) Failing after 11s
OSS 写入显式使用 v1 签名
ossutil v2 默认 v4 签名,缺 region 会直接失败\n总号写入与回读统一走 buildOssutilArgs,默认 --sign-version v1,可切 v4 并配合 AGC_OSS_REGION\n补充参数构造单测
2026-09-20 18:33:02 +08:00

62 lines
1.8 KiB
TypeScript

/* @vitest-environment jsdom */
import { afterEach, describe, expect, test, vi } from 'vitest';
import {
APP_HOME_TITLE,
resolveAppTitleForSelectionStage,
syncAppTitle,
} from './activeAppTitle';
const hostBridgeMock = vi.hoisted(() => ({
setHostAppTitle: vi.fn(),
}));
vi.mock('./host-bridge/hostBridge', () => ({
setHostAppTitle: hostBridgeMock.setHostAppTitle,
}));
afterEach(() => {
document.title = '';
hostBridgeMock.setHostAppTitle.mockReset();
});
describe('activeAppTitle', () => {
test('maps only active platform stages', () => {
expect(resolveAppTitleForSelectionStage('platform')).toBe(APP_HOME_TITLE);
expect(resolveAppTitleForSelectionStage('creation-home')).toBe(
APP_HOME_TITLE,
);
expect(resolveAppTitleForSelectionStage('project')).toBe('项目 - 陶泥儿');
expect(resolveAppTitleForSelectionStage('profile')).toBe('我的 - 陶泥儿');
expect(resolveAppTitleForSelectionStage('image-editor')).toBe(
'美术编辑器 - 陶泥儿',
);
expect(resolveAppTitleForSelectionStage('games')).toBe('游戏 - 陶泥儿');
expect(resolveAppTitleForSelectionStage('game-mine')).toBe(
'我的游戏 - 陶泥儿',
);
expect(resolveAppTitleForSelectionStage('game-publish')).toBe(
'发布游戏 - 陶泥儿',
);
});
test('syncs browser and host titles', () => {
syncAppTitle(' 项目 - 陶泥儿 ');
expect(document.title).toBe('项目 - 陶泥儿');
expect(hostBridgeMock.setHostAppTitle).toHaveBeenCalledWith({
title: '项目 - 陶泥儿',
});
});
test('falls back to the brand for an empty title', () => {
syncAppTitle(' ');
expect(document.title).toBe('陶泥儿');
expect(hostBridgeMock.setHostAppTitle).toHaveBeenCalledWith({
title: '陶泥儿',
});
});
});