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 (commit8b767da,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) <noreply@anthropic.com>
This commit is contained in:
@@ -34,8 +34,10 @@ def test_frontend_imports() -> None:
|
|||||||
def test_strategies_json_loadable() -> None:
|
def test_strategies_json_loadable() -> None:
|
||||||
files = importlib.resources.files("strategy_crypto") / "strategies"
|
files = importlib.resources.files("strategy_crypto") / "strategies"
|
||||||
found = sorted(p.name for p in files.iterdir() if p.name.endswith(".json"))
|
found = sorted(p.name for p in files.iterdir() if p.name.endswith(".json"))
|
||||||
assert "btc_fb63e851.json" in found
|
# Convenzione: almeno un winner BTC e uno ETH shippati col package.
|
||||||
assert "eth_facd6af85d5d.json" in found
|
# 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:
|
for fname in found:
|
||||||
data = json.loads((files / fname).read_text())
|
data = json.loads((files / fname).read_text())
|
||||||
assert "rules" in data, f"{fname} missing 'rules' key"
|
assert "rules" in data, f"{fname} missing 'rules' key"
|
||||||
|
|||||||
Reference in New Issue
Block a user