aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests')
-rw-r--r--packages/meshbay-node/tests/test_root_availability.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_root_availability.py b/packages/meshbay-node/tests/test_root_availability.py
index e92ec95..7cc890f 100644
--- a/packages/meshbay-node/tests/test_root_availability.py
+++ b/packages/meshbay-node/tests/test_root_availability.py
@@ -337,6 +337,19 @@ async def test_a_directory_moved_out_of_a_live_root_is_removed(tmp_path):
assert _names(idx) == {"e1.hd.mkv"}
+async def test_a_directory_reported_as_a_deleted_file_is_removed(tmp_path):
+ """What watchdog emits on Windows: the path is gone, so it cannot say it
+ was a directory, and a move out of the root arrives as a file deleted."""
+ shows = tmp_path / "Shows"
+ season = _season(shows, "S1", "e1.mp4", "e2.mp4")
+ _season(shows, "S2", "e3.mp4")
+ idx = await _indexer(_roots(shows))
+
+ os.rename(season, tmp_path / "S1")
+ await idx._update_entry(season, deleted=True, directory=False)
+ assert _names(idx) == {"e3.mp4"}
+
+
async def test_a_directory_event_from_a_vanished_root_freezes(tmp_path):
shows = tmp_path / "Shows"
season = _season(shows, "S1", "e1.mp4", "e2.mp4")