Whitelist more /cmds for no dirty commit

This commit is contained in:
Paul Gauthier 2023-07-16 13:42:36 -03:00
parent 4447f61dc6
commit 5dc7bc055e
3 changed files with 26 additions and 2 deletions

View file

@ -24,6 +24,26 @@ class TestCoder(unittest.TestCase):
def tearDown(self):
self.patcher.stop()
def test_should_dirty_commit(self):
# Mock the IO object
mock_io = MagicMock()
with GitTemporaryDirectory():
repo = git.Repo(Path.cwd())
fname = Path("new.txt")
fname.touch()
repo.git.add(str(fname))
repo.git.commit("-m", "new")
# Initialize the Coder object with the mocked IO and mocked repo
coder = Coder.create(models.GPT4, None, mock_io)
fname.write_text("hi")
self.assertTrue(coder.should_dirty_commit("hi"))
self.assertFalse(coder.should_dirty_commit("/exit"))
self.assertFalse(coder.should_dirty_commit("/help"))
def test_check_for_file_mentions(self):
# Mock the IO object
mock_io = MagicMock()