def test_read_dir_with_empty_dir(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should return an empty list with read_dir on an empty directory."""
    basenames = sync_filesystem.read_dir(tmp_path)

    assert basenames == []
def test_read_dir_walks_directories(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should ignore include files nested in directories in read_dir."""
    (tmp_path / "foo.json").touch()
    (tmp_path / "bar").mkdir()
    (tmp_path / "bar" / "baz.json").touch()
    basenames = sync_filesystem.read_dir(tmp_path)

    assert basenames == ["foo", "bar/baz"]
def test_read_dir_ignores_non_json_and_dotfiles(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should ignore dotfiles and non-JSON files with read_dir."""
    (tmp_path / "foo.json").touch()
    (tmp_path / ".bar.json").touch()
    (tmp_path / "baz.zip").touch()
    basenames = sync_filesystem.read_dir(tmp_path)

    assert basenames == ["foo"]
def test_read_dir_with_dir_of_json_files(
    tmp_path: Path, sync_filesystem: SyncFilesystem
) -> None:
    """It should return a list of JSON basenames with read_dir."""
    (tmp_path / "foo.json").touch()
    (tmp_path / "bar.json").touch()
    (tmp_path / "baz.json").touch()
    basenames = sync_filesystem.read_dir(tmp_path)

    assert set(basenames) == set(["foo", "bar", "baz"])