From 05c7b5e89ec6dbe5f3f8b260ef7cb634e69eac36 Mon Sep 17 00:00:00 2001 From: Adriano Dal Pastro Date: Mon, 18 May 2026 17:25:27 +0000 Subject: [PATCH] test(strategy_crypto): non hard-codare hash dei winner shippati L'assert su btc_fb63e851.json/eth_facd6af85d5d.json era diventato stale dopo i swap dei paper winner (commit 8b767da, 23b7273). Verifica strutturale (almeno un btc_*.json e un eth_*.json) evita il fail ad ogni futuro swap di winner. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/strategy_crypto/tests/test_imports.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/strategy_crypto/tests/test_imports.py b/src/strategy_crypto/tests/test_imports.py index c606949..83e7a31 100644 --- a/src/strategy_crypto/tests/test_imports.py +++ b/src/strategy_crypto/tests/test_imports.py @@ -34,8 +34,10 @@ def test_frontend_imports() -> None: def test_strategies_json_loadable() -> None: files = importlib.resources.files("strategy_crypto") / "strategies" found = sorted(p.name for p in files.iterdir() if p.name.endswith(".json")) - assert "btc_fb63e851.json" in found - assert "eth_facd6af85d5d.json" in found + # Convenzione: almeno un winner BTC e uno ETH shippati col package. + # Non hard-codare hash specifici: cambiano ad ogni swap di paper winner. + assert any(n.startswith("btc_") for n in found), f"no btc_*.json in {found}" + assert any(n.startswith("eth_") for n in found), f"no eth_*.json in {found}" for fname in found: data = json.loads((files / fname).read_text()) assert "rules" in data, f"{fname} missing 'rules' key"