31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
from pathlib import Path
|
|||
|
|
import json
|
||
|
|
import unittest
|
||
|
|
|
||
|
|
|
||
|
|
ROOT = Path(__file__).parents[2]
|
||
|
|
|
||
|
|
|
||
|
|
class MatchmakerRecommendationContractTest(unittest.TestCase):
|
||
|
|
def test_recommendation_page_is_registered_and_user_decision_only(self):
|
||
|
|
app = json.loads((ROOT / "miniapp/app.json").read_text(encoding="utf-8"))
|
||
|
|
self.assertIn("pages/matchmaker-recommendations/matchmaker-recommendations", app["pages"])
|
||
|
|
source = (ROOT / "miniapp/pages/matchmaker-recommendations/matchmaker-recommendations.js").read_text(encoding="utf-8")
|
||
|
|
self.assertIn("fetchRecommendations", source)
|
||
|
|
self.assertIn("matchStore.like", source)
|
||
|
|
self.assertIn("matchStore.pass", source)
|
||
|
|
self.assertNotIn("operatorToken", source)
|
||
|
|
|
||
|
|
def test_matchmaker_service_routes_to_dedicated_recommendation_page(self):
|
||
|
|
source = (ROOT / "miniapp/pages/matchmaker/matchmaker.ts").read_text(encoding="utf-8")
|
||
|
|
self.assertIn("MATCHMAKER_RECOMMENDATIONS", source)
|
||
|
|
self.assertNotIn("ROUTE.MAIN.FATE_CENTER, { id: serviceId }", source)
|
||
|
|
|
||
|
|
def test_recommendation_store_accepts_array_api_response(self):
|
||
|
|
source = (ROOT / "miniapp/stores/matchmakerStore.js").read_text(encoding="utf-8")
|
||
|
|
self.assertIn("Array.isArray(result)", source)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
unittest.main()
|