FastAPI + SQLAlchemy/Alembic + MariaDB backend with Jinja2/htmx/Alpine server-rendered frontend. Multi-user via Google OAuth, daily habit tracking, monthly/weekly history views, Web Push reminders via APScheduler, and PWA support (manifest, service worker, offline caching). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1005 B
Python
32 lines
1005 B
Python
from app.models.habit import ALL_WEEKDAYS_MASK
|
|
from app.template_utils import heatmap_opacity, weekday_label
|
|
|
|
|
|
def test_weekday_label_all_days_shows_daily():
|
|
assert weekday_label(ALL_WEEKDAYS_MASK) == "매일"
|
|
|
|
|
|
def test_weekday_label_lists_selected_days_in_order():
|
|
monday_and_wednesday = 0b0000001 | 0b0000100
|
|
assert weekday_label(monday_and_wednesday) == "월, 수"
|
|
|
|
|
|
def test_weekday_label_no_days_selected():
|
|
assert weekday_label(0) == "선택된 요일 없음"
|
|
|
|
|
|
def test_heatmap_opacity_zero_when_nothing_scheduled():
|
|
assert heatmap_opacity(checked_count=0, scheduled_count=0) == 0.0
|
|
|
|
|
|
def test_heatmap_opacity_zero_when_nothing_checked():
|
|
assert heatmap_opacity(checked_count=0, scheduled_count=5) == 0.0
|
|
|
|
|
|
def test_heatmap_opacity_full_ratio_caps_at_point_nine():
|
|
assert heatmap_opacity(checked_count=5, scheduled_count=5) == 0.9
|
|
|
|
|
|
def test_heatmap_opacity_partial_ratio():
|
|
assert heatmap_opacity(checked_count=1, scheduled_count=2) == round(0.12 + 0.5 * 0.78, 2)
|