Test executing the clear command.
(self, command)
| 22 | |
| 23 | @pytest.mark.asyncio |
| 24 | async def test_execute(self, command): |
| 25 | """Test executing the clear command.""" |
| 26 | with patch("chuk_term.ui.clear_screen") as mock_clear: |
| 27 | with patch("chuk_term.ui.display_chat_banner") as mock_banner: |
| 28 | # Mock get_context from the context module |
| 29 | with patch("mcp_cli.context.get_context") as mock_context: |
| 30 | mock_context.return_value = None |
| 31 | |
| 32 | result = await command.execute() |
| 33 | |
| 34 | # Verify clear_screen was called |
| 35 | mock_clear.assert_called_once() |
| 36 | # Banner should not be called when no context |
| 37 | mock_banner.assert_not_called() |
| 38 | |
| 39 | # Check result |
| 40 | assert result.success is True |
| 41 | assert result.should_clear is False # We handle clearing internally |
| 42 | |
| 43 | @pytest.mark.asyncio |
| 44 | async def test_execute_with_context(self, command): |