FitMop/backend/tests/test_recommendations.py

38 lines
1.2 KiB
Python

import pytest
from recommendations.engine import RecommendationEngine
def test_get_recommendation_cycling():
engine = RecommendationEngine()
history = [{"activityName": "Morning Ride", "activityType": {"typeKey": "cycling"}}]
objective = "endurance"
rec = engine.get_recommendation(history, objective)
assert "HIIT" in rec
def test_get_recommendation_strength():
engine = RecommendationEngine()
history = [{"activityName": "Upper Body", "activityType": {"typeKey": "strength_training"}}]
objective = "strong"
rec = engine.get_recommendation(history, objective)
assert "leg strength" in rec
def test_get_recommendation_default():
engine = RecommendationEngine()
history = []
objective = "fitness"
rec = engine.get_recommendation(history, objective)
assert "consistent work" in rec
def test_summarize_history_empty():
engine = RecommendationEngine()
summary = engine._summarize_history([])
assert "No recent training data" in summary
def test_summarize_history_with_data():
engine = RecommendationEngine()
history = [{"activityName": "Run", "activityType": {"typeKey": "running"}}]
summary = engine._summarize_history(history)
assert "- Run (running)" in summary