ForcePilot/backend/test/test_conversation_repository.py
Wenjie Zhang 410dd47c14 refactor: 将后端代码迁移至 backend 目录
- 将 server/, src/, scripts/, test/ 等目录移动到 backend/ 目录下
- 使用 git rename 保留文件历史记录
- 更新 docker-compose.yml 和 api.Dockerfile 配置

WIP: 项目结构重构进行中
2026-03-24 11:08:12 +08:00

23 lines
728 B
Python

from __future__ import annotations
from yuxi.repositories.conversation_repository import ConversationRepository, MAX_CONVERSATION_TITLE_LENGTH
def test_normalize_title_truncates_when_too_long():
repo = ConversationRepository(None) # type: ignore[arg-type]
raw = "a" * (MAX_CONVERSATION_TITLE_LENGTH + 50)
normalized = repo._normalize_title(raw)
assert normalized is not None
assert len(normalized) == MAX_CONVERSATION_TITLE_LENGTH
assert normalized == "a" * MAX_CONVERSATION_TITLE_LENGTH
def test_normalize_title_trims_spaces():
repo = ConversationRepository(None) # type: ignore[arg-type]
normalized = repo._normalize_title(" hello world ")
assert normalized == "hello world"