From f2d0c0f865a73b6c2b43549366604c7381fca8cb Mon Sep 17 00:00:00 2001 From: Edern Deneuville Date: Fri, 11 Sep 2026 13:24:06 +0200 Subject: [PATCH] Add clipboard workflow tests --- tests/test_clipboard_capture.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/test_clipboard_capture.py diff --git a/tests/test_clipboard_capture.py b/tests/test_clipboard_capture.py new file mode 100644 index 0000000..e4f66cc --- /dev/null +++ b/tests/test_clipboard_capture.py @@ -0,0 +1,16 @@ +from ai_typewriter.clipboard_capture import capture_clipboard, capture_selection + + +def test_capture_clipboard_reads_current_clipboard(monkeypatch): + monkeypatch.setattr("ai_typewriter.clipboard_capture.pyperclip.paste", lambda: "phrase copiée") + + assert capture_clipboard() == "phrase copiée" + + +def test_legacy_capture_selection_does_not_copy_or_modify_clipboard(monkeypatch): + calls = [] + monkeypatch.setattr("ai_typewriter.clipboard_capture.pyperclip.paste", lambda: "déjà copié") + monkeypatch.setattr("ai_typewriter.clipboard_capture.pyperclip.copy", lambda value: calls.append(value), raising=False) + + assert capture_selection() == "déjà copié" + assert calls == []