diff options
| author | Martin Bielik <martin.bielik@instea.sk> | 2024-12-17 18:43:51 +0100 |
|---|---|---|
| committer | Martin Bielik <martin.bielik@instea.sk> | 2024-12-17 18:43:51 +0100 |
| commit | 8402371e6af33dcf6962ffbc8cd73be0e36f6812 (patch) | |
| tree | 21086a322a0901e9b3ea66e1da318377960808dd /tests | |
| parent | 44625c9d77f6c44f1a4623402cada772dfaf6f9f (diff) | |
| download | vim-ai-8402371e6af33dcf6962ffbc8cd73be0e36f6812.tar.gz | |
introduced pre-defined default roles
Diffstat (limited to '')
| -rw-r--r-- | tests/context_test.py | 14 | ||||
| -rw-r--r-- | tests/mocks/vim.py | 4 | ||||
| -rw-r--r-- | tests/roles_test.py | 4 |
3 files changed, 21 insertions, 1 deletions
diff --git a/tests/context_test.py b/tests/context_test.py index 9f7d004..1cc0330 100644 --- a/tests/context_test.py +++ b/tests/context_test.py @@ -126,6 +126,20 @@ def test_chat_only_role(): actual_config = context['config'] assert 'preset_tab' == actual_config['options']['open_chat_command'] +def test_default_roles(): + base = { + 'config_default': default_config, + 'config_extension': {}, + 'user_instruction': '/chat-only-role', + 'user_selection': '', + 'command_type': 'chat', + } + context = make_ai_context({ **base, 'user_instruction': '/right hello world!' }) + assert 'preset_right' == context['config']['ui']['open_chat_command'] + + context = make_ai_context({ **base, 'user_instruction': '/tab' }) + assert 'preset_tab' == context['config']['ui']['open_chat_command'] + def test_user_prompt(): assert 'fix grammar: helo word' == make_prompt( '', 'fix grammar: helo word', '', '') assert 'fix grammar:\nhelo word' == make_prompt( '', 'fix grammar', 'helo word', '') diff --git a/tests/mocks/vim.py b/tests/mocks/vim.py index c0e01e9..9dd8860 100644 --- a/tests/mocks/vim.py +++ b/tests/mocks/vim.py @@ -7,7 +7,9 @@ def eval(cmd): case 'g:vim_ai_debug_log_file': return '/tmp/vim_ai_debug.log' case 'g:vim_ai_roles_config_file': - return os.path.join(dirname, '..', 'resources/roles.ini') + return os.path.join(dirname, '../resources/roles.ini') + case 's:plugin_root': + return os.path.join(dirname, '../..') case _: return None diff --git a/tests/roles_test.py b/tests/roles_test.py index ac5525d..da9b9a4 100644 --- a/tests/roles_test.py +++ b/tests/roles_test.py @@ -17,4 +17,8 @@ def test_role_chat_only(): 'chat-only-role', 'deprecated-test-role-simple', 'deprecated-test-role', + # default roles + 'right', + 'below', + 'tab', } |