diff --git a/tests/test_coder.py b/tests/test_coder.py index 72b247727..8689f863f 100644 --- a/tests/test_coder.py +++ b/tests/test_coder.py @@ -22,6 +22,23 @@ class TestCoder(unittest.TestCase): def tearDown(self): self.patcher.stop() + def test_new_file_commit_message(self): + with GitTemporaryDirectory(): + repo = git.Repo() + fname = Path("foo.txt") + + io = InputOutput(yes=True) + # Initialize the Coder object with the mocked IO and mocked repo + coder = Coder.create(models.GPT4, None, io, fnames=[str(fname)]) + + self.assertTrue(fname.exists()) + + # Get the latest commit message + commit_message = repo.head.commit.message + # Check that the latest commit message contains the filename + self.assertIn(str(fname), commit_message) + + def test_allowed_to_edit(self): with GitTemporaryDirectory(): repo = git.Repo(Path.cwd())