diff --git a/eden/integration/changes_test.py b/eden/integration/changes_test.py index 95c16cfd148ec..329a8702847d7 100644 --- a/eden/integration/changes_test.py +++ b/eden/integration/changes_test.py @@ -150,6 +150,9 @@ def setup_test_rename_file(self) -> ChangesSinceV2Result: self.rename("test_file", "best_file") return self.getChangesSinceV2(position=position) + def repo_rmdir(self, path) -> None: + self.rmdir(path) + class WindowsTestBase(ChangesTestBase): SYNC_MAX: int = 1 @@ -179,6 +182,16 @@ def rename(self, from_path, to_path) -> None: super().rename(from_path, to_path) self.syncProjFS(position) + def mkdir(self, path) -> None: + position = self.client.getCurrentJournalPosition(self.mount_path_bytes) + super().mkdir(path) + self.syncProjFS(position) + + def repo_rmdir(self, path) -> None: + position = self.client.getCurrentJournalPosition(self.mount_path_bytes) + super().rmdir(path) + self.syncProjFS(position) + if sys.platform == "win32": testBase = WindowsTestBase @@ -228,6 +241,34 @@ def test_remove_file(self): ] self.assertTrue(self.check_changes(changes.changes, expected_changes)) + def test_add_folder(self): + position = self.client.getCurrentJournalPosition(self.mount_path_bytes) + # self.repo_write_file("test_folder/test_file", "", add=False) + self.mkdir("test_folder") + changes = self.getChangesSinceV2(position=position) + expected_changes = [ + buildSmallChange( + SmallChangeNotification.ADDED, + Dtype.DIR, + path=b"test_folder", + ), + ] + self.assertTrue(self.check_changes(changes.changes, expected_changes)) + + def test_remove_folder(self): + self.mkdir("test_folder") + position = self.client.getCurrentJournalPosition(self.mount_path_bytes) + self.repo_rmdir("test_folder") + changes = self.getChangesSinceV2(position=position) + expected_changes = [ + buildSmallChange( + SmallChangeNotification.REMOVED, + Dtype.DIR, + path=b"test_folder", + ), + ] + self.assertTrue(self.check_changes(changes.changes, expected_changes)) + # The following tests have different results based on platform