fix:APP-push点击文案显示home页
This commit is contained in:
32
server/tests/test_push_payload.py
Normal file
32
server/tests/test_push_payload.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.features.push_payload import build_home_push_data
|
||||
|
||||
|
||||
def test_build_home_push_data_contains_home_route_fields() -> None:
|
||||
payload = build_home_push_data(
|
||||
client_user_id="client-123",
|
||||
body="今天也请温柔地对自己说话。",
|
||||
scene="push",
|
||||
content_id=9,
|
||||
)
|
||||
|
||||
assert payload == {
|
||||
"client_user_id": "client-123",
|
||||
"scene": "push",
|
||||
"target_screen": "home",
|
||||
"deep_link": "client://home",
|
||||
"home_text": "今天也请温柔地对自己说话。",
|
||||
"content_id": 9,
|
||||
}
|
||||
|
||||
|
||||
def test_build_home_push_data_omits_content_id_when_missing() -> None:
|
||||
payload = build_home_push_data(
|
||||
client_user_id="client-123",
|
||||
body="先看到这句,再回到首页。",
|
||||
)
|
||||
|
||||
assert "content_id" not in payload
|
||||
assert payload["target_screen"] == "home"
|
||||
assert payload["home_text"] == "先看到这句,再回到首页。"
|
||||
Reference in New Issue
Block a user