Files
resume-agent/backend/tests/test_enrichment_progress.py
T
hypandClaude ae2d9b128d feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本:
- Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强)
- 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护
- 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏
- PostgreSQL 运行时 + Alembic 迁移链

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 11:08:30 +08:00

70 lines
2.2 KiB
Python

"""进度卡规则:total 固定为队列长度;skip 只切卡不推进度;进度卡无 skip 动作。"""
from __future__ import annotations
from fastapi.testclient import TestClient
from app.enrichment_modules import module_by_name
from app.fsm_enrichment import (
ensure_enrichment_state,
enrichment_progress,
mark_completed,
skip_module,
)
from test_api import BASE, active_component
from test_enrichment_flow import (
continue_enriching,
created_session,
find_component,
skip_current,
)
def _campus_profile() -> dict:
return {"job_type": "campus", "anchor_type": "education", "anchor": {}, "experiences": []}
def test_progress_fixed_total_and_skip_does_not_advance():
profile = _campus_profile()
ensure_enrichment_state(profile)
mark_completed(profile, "internship")
progress = enrichment_progress(profile)
assert progress["total"] == 5
assert progress["ratio"] == 1 / 5
skip_module(profile, module_by_name("competition"))
progress = enrichment_progress(profile)
assert progress["total"] == 5
assert progress["completed"] == 1
assert progress["skipped"] == 1
assert progress["ratio"] == 1 / 5
def test_skip_keeps_total_fixed_and_progress_card_has_no_skip(client: TestClient):
session_id, body = created_session(client)
body = continue_enriching(client, session_id, body)
stale_block = active_component(body)
body = skip_current(client, session_id, body)
progress = find_component(body, "progress_card")
assert progress["data"]["total"] == 5
assert progress["data"]["skipped"] == 1
assert progress["data"]["completed"] == 0
assert progress["data"]["percent"] == 0
assert progress["data"]["actions"] == ["defer"]
replay = client.post(
f"{BASE}/sessions/{session_id}/component-events",
json={
"component_id": stale_block["id"],
"event": "submit",
"payload": {
"company": "星河科技",
"position": "后端实习生",
"start_date": "2024-03",
"end_date_or_present": "2024-09",
},
},
)
assert replay.status_code == 409