"""Governance: how many new sleeves may promote this cycle, given caps + kill-switch."""
from __future__ import annotations

from fxhnt.application.factory.governance import promote_budget


def test_kill_switch_blocks_all() -> None:
    assert promote_budget(kill_switch=True, deployed=3, max_deployed=20, max_new_per_cycle=2) == 0


def test_capacity_and_burst_caps() -> None:
    assert promote_budget(kill_switch=False, deployed=19, max_deployed=20, max_new_per_cycle=2) == 1  # only 1 slot
    assert promote_budget(kill_switch=False, deployed=5, max_deployed=20, max_new_per_cycle=2) == 2    # burst cap
    assert promote_budget(kill_switch=False, deployed=20, max_deployed=20, max_new_per_cycle=2) == 0   # full
