fix: 任务开始后显示已开启和学时刷新倒计时

This commit is contained in:
2026-11-17 12:07:45 +08:00
parent e30e2321e7
commit ad0b18ecfc
4 changed files with 43 additions and 4 deletions
+13
View File
@@ -469,6 +469,19 @@ def test_manual_start_expires_when_the_month_changes() -> None:
assert study_eligible(account, datetime(2026, 12, 1, tzinfo=CN_TZ)) is False
def test_assemble_reports_hours_refresh_countdown(monkeypatch) -> None:
import time
monkeypatch.setattr("euniv.autostudy.work_running", lambda _eid: True)
account = _Start(1, 0, 0, 0)
account.employee_id = "u-hours"
payload = assemble(account, {"hours_refresh_at": time.time() + 40})
assert 1 <= payload["hours_refresh_in"] <= 40
monkeypatch.setattr("euniv.autostudy.work_running", lambda _eid: False)
stopped = assemble(account, {"hours_refresh_at": time.time() + 40})
assert stopped["hours_refresh_in"] == 0
def test_hours_met_clears_started_without_pause() -> None:
account = _Start(1, 0, 0, 0)
start_now(account)