feat: 로딩 스켈레톤·행사 사진·전시·주말 예상 점수·노을 탭 재정리 등 화면 전반 개선
- 화면 전체 스켈레톤, 로딩·완료·실패 사이 레이아웃 고정, 값 없음은 '?' - 행사 사진·출처 표시, 문화정보 API 전시 연결, 행사 30km 거리 기준 - 각 상세 점수 칸 오늘/내일/토/일, 단기예보 밖 주말은 중기예보 예상 점수 - 6각 차트 축 이름을 좋은 방향으로, 계산 근거 문구 정리 - 아이콘 오용·뜻 모를 표시·빈 데이터·포스트 본문 반복 수정 - 미세먼지 별도 포스트, 노을 명소 전국 155곳 거리 기준, 노을 탭 결론 중심 재구성 - 밤 다크 테마·별똥별, 댓글·좋아요 대기·실패 표시 - 주말 전국 랭킹·당일치기 카드, 계절 이야기 사진 수집 - 문서: 포스트 타입별 내용, 각 데이터 정리, TODO 진행 순서
This commit is contained in:
1 parent
296a09d6db
commit
ddf05aeb5c
97 files changed
+5475
-720
No files matched your search
@@ -1,4 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from datetime import date, timedelta
|
||||
|
||||
import pytest
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
@@ -8,6 +8,7 @@ import services.warning_service as warning_service
|
||||
import services.weather_service as weather_service
|
||||
from common.utils.kma_time import kst_midnight, now_kst
|
||||
from router.router import app
|
||||
from services.index_service import slot_days, slot_label
|
||||
|
||||
REGION = "1141000000"
|
||||
|
||||
@@ -26,6 +27,12 @@ def _vilage(*_):
|
||||
return items
|
||||
|
||||
|
||||
def _mid(*_):
|
||||
land = {f"wf{n}{p}": "맑음" for n in range(4, 11) for p in ("Am", "Pm")} | {f"rnSt{n}{p}": 10 for n in range(4, 11) for p in ("Am", "Pm")}
|
||||
ta = {f"taMin{n}": 12 for n in range(4, 11)} | {f"taMax{n}": 22 for n in range(4, 11)}
|
||||
return land, ta
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fakes(monkeypatch):
|
||||
now = now_kst()
|
||||
@@ -36,17 +43,22 @@ def fakes(monkeypatch):
|
||||
"dataTime": now.replace(minute=0).strftime("%Y-%m-%d %H:%M"),
|
||||
}]))
|
||||
monkeypatch.setattr(warning_service, "fetch_warning_events", lambda *a: _async([]))
|
||||
monkeypatch.setattr(weather_service, "fetch_mid", lambda *a: _async(_mid()))
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_index_list_ranks_all_27_with_3_day_trend(fakes):
|
||||
async def test_index_list_ranks_all_27_with_today_tomorrow_weekend_trend(fakes):
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
||||
body = (await client.get("/v1/index/list", params={"region": REGION})).json()
|
||||
assert body["result"]["success"] is True
|
||||
assert len(body["items"]) == 27 and len(body["top3"]) == 3
|
||||
scores = [i["score"] for i in body["items"]]
|
||||
assert scores == sorted(scores, reverse=True)
|
||||
assert all(len(i["trend"]) == 3 for i in body["items"])
|
||||
today = now_kst().date()
|
||||
for i in body["items"]:
|
||||
assert [t["label"] for t in i["trend"]] == [slot_label(d, today) for d in slot_days(today)]
|
||||
assert not any(t["estimated"] for t in i["trend"][:2])
|
||||
assert all(t["estimated"] for t in i["trend"][2:] if date.fromisoformat(t["day"]) > today + timedelta(days=3))
|
||||
assert 0 <= body["weather_score"] <= 100
|
||||
|
||||
|
||||
@@ -62,7 +74,7 @@ async def test_index_detail_has_six_factors_and_rules(fakes):
|
||||
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
|
||||
body = (await client.get("/v1/index/1", params={"region": REGION})).json()
|
||||
assert body["index"]["code"] == "yajang"
|
||||
assert [f["label"] for f in body["factors"]] == ["기온", "비", "바람", "습도", "공기", "시간대"]
|
||||
assert [f["label"] for f in body["factors"]] == ["기온 알맞음", "비 안 옴", "바람 잔잔", "습도 알맞음", "공기 맑음", "요일 알맞음"]
|
||||
assert sum(f["weight"] for f in body["factors"]) == 100
|
||||
assert body["zero_rules"] == "비 확률 80% 이상 또는 바람 14m/s 이상이면 바로 0점"
|
||||
assert body["zero_rules"] == "비 확률 80% 이상이거나 바람 14m/s 이상이면 0점"
|
||||
assert body["limit"].startswith("모기")
|
||||
Reference in new issue
Block a user