修改前端漏斗
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from app.web import _filter_alerts_within_hours
|
||||
|
||||
|
||||
def test_filter_alerts_within_hours_keeps_recent() -> None:
|
||||
now = datetime.utcnow()
|
||||
alerts = [
|
||||
{"symbol": "BTC", "created_at": (now - timedelta(hours=1)).isoformat()},
|
||||
{"symbol": "ETH", "created_at": (now - timedelta(hours=30)).isoformat()},
|
||||
]
|
||||
out = _filter_alerts_within_hours(alerts, within_hours=24.0)
|
||||
assert [a["symbol"] for a in out] == ["BTC"]
|
||||
Reference in New Issue
Block a user