fix(home): server-owned growth window; expose days
Home omits growth_days; backend auto (or home_growth_days 1/7) picks the window. Response includes days alongside growth_days. Growth榜 link uses the returned days. Non-growth sorts treat omitted/auto as 7.
This commit is contained in:
1 parent
9163f47b76
commit
297d9279d8
5 files changed
+52
-28
No files matched your search
@@ -108,8 +108,11 @@ def test_readonly_routes_and_static():
|
||||
|
||||
status, _, payload = running.request("/api/videos")
|
||||
assert status == 200
|
||||
items = json.loads(payload)["data"]["items"]
|
||||
heat_payload = json.loads(payload)["data"]
|
||||
items = heat_payload["items"]
|
||||
assert items and items[0]["aid"] == 102
|
||||
# 非增长排序:省略 growth_days 时 days/growth_days 回落为 7,不做 7→1
|
||||
assert heat_payload["days"] == heat_payload["growth_days"] == 7
|
||||
|
||||
status, _, payload = running.json("/api/videos?year=2026")
|
||||
assert status == 200
|
||||
@@ -120,6 +123,13 @@ def test_readonly_routes_and_static():
|
||||
assert status == 200
|
||||
assert payload["data"]["year"] == 2026
|
||||
|
||||
# 首页形态:省略 growth_days → 后端 auto,响应带 days/growth_days
|
||||
status, _, payload = running.json("/api/videos?sort=growth&limit=6")
|
||||
assert status == 200
|
||||
growth = payload["data"]
|
||||
assert growth["days"] == growth["growth_days"] == 1
|
||||
assert growth["available"] is True
|
||||
|
||||
status, _, payload = running.request("/api/ups")
|
||||
assert status == 200
|
||||
assert json.loads(payload)["data"]["sort"] == "efficiency"
|
||||
|
||||
Reference in new issue
Block a user