自动生成的草稿里,时间线只查了 activity.action,没带 payload, 于是每条状态变化都变成一模一样的「状态变更」,读者看不出事情怎么走的。 - services/knowledge.snapshot_source 多取 Activity.payload 一起交给渲染 - domain/knowledge 加 STATUS_LABEL 与 _describe(),把 payload 的 from/to 翻成人话 - 新增用例断言草稿里有「待办 → 进行中」「进行中 → 已完成」 66 passed。
This commit is contained in:
@@ -340,3 +340,31 @@ async def test_patch_uses_optimistic_lock(client: AsyncClient) -> None:
|
||||
)
|
||||
assert stale.json()["code"] == 4009
|
||||
assert stale.json()["data"]["current_version"] == updated["version"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_draft_timeline_reads_like_a_story(client: AsyncClient) -> None:
|
||||
"""过程段要写「待办 → 已完成」,只写"状态变更"等于没写。
|
||||
|
||||
这条用例是有来历的:时间线最初只查了 action,没带 payload,
|
||||
结果生成的草稿里全是"状态变更",看不出事情是怎么走的。
|
||||
"""
|
||||
owner = await login(client)
|
||||
ws = await create_workspace(client, owner, "时间线")
|
||||
task = await _task(client, owner, ws["id"], "写清楚每一步")
|
||||
for status in ("todo", "doing", "done"):
|
||||
task = unwrap(
|
||||
await client.post(
|
||||
f"{V1}/workspaces/{ws['id']}/items/{task['id']}/status",
|
||||
json={"status": status, "version": task["version"]},
|
||||
headers=owner["headers"],
|
||||
)
|
||||
)
|
||||
doc = unwrap(
|
||||
await client.post(
|
||||
f"{V1}/workspaces/{ws['id']}/items/{task['id']}/knowledge", headers=owner["headers"]
|
||||
)
|
||||
)
|
||||
body = doc["body_md"]
|
||||
assert "待办 → 进行中" in body
|
||||
assert "进行中 → 已完成" in body
|
||||
|
||||
Reference in New Issue
Block a user