Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai>
Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Guillaume LE GOFF 2026-06-12 13:16:04 +02:00 committed by GitHub
parent 702d0f412e
commit cafb6d4147
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
247 changed files with 12401 additions and 3029 deletions

View file

@ -228,3 +228,67 @@ class TestBannerConnectorsCount:
assert banner._initial_state.connectors_connected == 3
assert banner._initial_state.connectors_total == 5
class TestBannerHooksCount:
def test_hooks_count_passed_through(self) -> None:
skill_manager = Mock(spec=SkillManager)
skill_manager.custom_skills_count = 0
banner = Banner(
config=_make_mock_config(), skill_manager=skill_manager, hooks_count=4
)
assert banner._initial_state.hooks_count == 4
def test_hooks_count_defaults_to_zero(self) -> None:
skill_manager = Mock(spec=SkillManager)
skill_manager.custom_skills_count = 0
banner = Banner(config=_make_mock_config(), skill_manager=skill_manager)
assert banner._initial_state.hooks_count == 0
def test_format_meta_counts_shows_hooks_when_present(self) -> None:
skill_manager = Mock(spec=SkillManager)
skill_manager.custom_skills_count = 0
banner = Banner(config=_make_mock_config(), skill_manager=skill_manager)
banner.state = BannerState(models_count=1, skills_count=0, hooks_count=3)
result = banner._format_meta_counts()
assert "3 hooks" in result
def test_format_meta_counts_singular_hook(self) -> None:
skill_manager = Mock(spec=SkillManager)
skill_manager.custom_skills_count = 0
banner = Banner(config=_make_mock_config(), skill_manager=skill_manager)
banner.state = BannerState(models_count=1, skills_count=0, hooks_count=1)
result = banner._format_meta_counts()
assert "1 hook" in result
assert "1 hooks" not in result
def test_format_meta_counts_hides_hooks_when_zero(self) -> None:
skill_manager = Mock(spec=SkillManager)
skill_manager.custom_skills_count = 0
banner = Banner(config=_make_mock_config(), skill_manager=skill_manager)
banner.state = BannerState(models_count=1, skills_count=0, hooks_count=0)
result = banner._format_meta_counts()
assert "hook" not in result
def test_set_state_updates_hooks_count(self) -> None:
skill_manager = Mock(spec=SkillManager)
skill_manager.custom_skills_count = 0
banner = Banner(
config=_make_mock_config(), skill_manager=skill_manager, hooks_count=0
)
banner.set_state(
config=_make_mock_config(), skill_manager=skill_manager, hooks_count=7
)
assert banner.state.hooks_count == 7