Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Jean-Malo Delignon <56539593+jean-malo@users.noreply.github.com>
Co-authored-by: Paul Cacheux <paul.cacheux@mistral.ai>
Co-authored-by: Quentin <torroba.q@gmail.com>
Co-authored-by: angelapopopo <angele.lenglemetz@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Clément Drouin 2026-03-31 16:28:55 +02:00 committed by GitHub
parent 6a50d1d521
commit 54b9a17457
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 1000 additions and 200 deletions

View file

@ -38,6 +38,12 @@ class MockWidget:
return self._get_selection_result
class MockWidgetNoScreen:
@property
def text_selection(self) -> object:
raise RuntimeError("node has no screen")
@pytest.fixture
def mock_app() -> App:
app = MagicMock(spec=App)
@ -73,6 +79,7 @@ def mock_app() -> App:
],
"empty text",
),
([MockWidgetNoScreen()], "widget with no screen (text_selection raises)"),
],
)
def test_copy_selection_to_clipboard_no_notification(
@ -87,6 +94,22 @@ def test_copy_selection_to_clipboard_no_notification(
mock_app.notify.assert_not_called()
@patch("vibe.cli.clipboard._copy_to_clipboard")
def test_copy_selection_skips_detached_widget_and_collects_valid(
mock_copy_to_clipboard: MagicMock, mock_app: MagicMock
) -> None:
detached = MockWidgetNoScreen()
valid = MockWidget(
text_selection=SimpleNamespace(), get_selection_result=("valid text", None)
)
mock_app.query.return_value = [detached, valid]
result = copy_selection_to_clipboard(mock_app)
assert result == "valid text"
mock_copy_to_clipboard.assert_called_once_with("valid text")
@patch("vibe.cli.clipboard._copy_to_clipboard")
def test_copy_selection_to_clipboard_success(
mock_copy_to_clipboard: MagicMock, mock_app: MagicMock