diff --git a/tests/test_commands.py b/tests/test_commands.py index 1aa4fcba1..3a2749122 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -87,12 +87,19 @@ class TestCommands(TestCase): coder = Coder.create(models.GPT35, None, io, openai_api_key="deadbeef") commands = Commands(io, coder) - # Create a directory + # Create a directory and add files to it os.mkdir("test_dir") + with open("test_dir/test_file1.txt", "w") as f: + f.write("Test file 1") + with open("test_dir/test_file2.txt", "w") as f: + f.write("Test file 2") # Call the cmd_add method with a directory - with self.assertRaises(IsADirectoryError): - commands.cmd_add("test_dir") + commands.cmd_add("test_dir") + + # Check if the files have been added to the chat session + self.assertIn(str(Path("test_dir/test_file1.txt").resolve()), coder.abs_fnames) + self.assertIn(str(Path("test_dir/test_file2.txt").resolve()), coder.abs_fnames) def test_cmd_drop_with_glob_patterns(self): # Initialize the Commands and InputOutput objects