@@ -65,10 +65,10 @@ export async function renderUp(root, { params, query }) {
按该 UP 全部视频的每日播放合计绘制;缺失日期断开。
-
diff --git a/tests/test_web_queries.py b/tests/test_web_queries.py
index 4c89f64..584503d 100644
--- a/tests/test_web_queries.py
+++ b/tests/test_web_queries.py
@@ -171,6 +171,7 @@ def test_up_queries():
db, q = setup(tmp)
try:
ups = q.list_ups()
+ assert ups["sort"] == "avg_views"
assert ups["total"] == 2
assert ups["items"][0]["up_mid"] == 1
assert ups["items"][0]["video_count"] == 2
@@ -212,6 +213,15 @@ def test_fans_candidates_system_and_export():
wide = q.fans(days=30)
assert wide["dates"] == list(DATES)
+ # 缺失前一天时不能把跨多天的变化标成“日增”
+ db.write(lambda conn: conn.execute(
+ "DELETE FROM up_stat WHERE mid=37754047 AND stat_date=?",
+ ("2026-10-30",),
+ ))
+ gapped = q.fans(days=3)
+ assert gapped["delta_1d"] is None
+ assert gapped["delta_7d"] is None
+
candidates = q.candidates()
assert candidates["total"] == 2
assert candidates["pending"] == 1
diff --git a/tests/test_web_server.py b/tests/test_web_server.py
index 60d7611..d9d805a 100644
--- a/tests/test_web_server.py
+++ b/tests/test_web_server.py
@@ -89,6 +89,10 @@ def test_readonly_routes_and_static():
items = json.loads(payload)["data"]["items"]
assert items and items[0]["aid"] == 102
+ status, _, payload = running.request("/api/ups")
+ assert status == 200
+ assert json.loads(payload)["data"]["sort"] == "avg_views"
+
status, headers, payload = running.request("/api/videos", method="HEAD")
assert status == 200 and payload == b""
assert "Content-Length" in headers