from fxhnt.application.gate_policy import POLICY
from fxhnt.application.gate_policy_resolve import resolve_policy


def test_unset_falls_back_to_policy_default():
    r = resolve_policy(POLICY, {})
    assert r.min_forward_days == 14 and r.recon_tolerance_frac == 0.5 and r.max_gap_days == 1
    assert r.min_days == 20 and r.min_sharpe == 0.0


def test_gate_spec_override_wins():
    r = resolve_policy(POLICY, {"min_forward_days": 21, "max_gap_days": 4, "min_sharpe": 0.5})
    assert r.min_forward_days == 21 and r.max_gap_days == 4 and r.min_sharpe == 0.5
    assert r.recon_tolerance_frac == 0.5   # unset field still the default
