import sys
from pathlib import Path

import pytest
from clarabot_nano_common.utility.path.root import get_root_paths


@pytest.mark.skipif(not sys.platform.startswith("win"), reason="for windows only")
def test_get_root_paths_nt():
    roots = get_root_paths()
    assert "C:/" in roots, str(roots)
    for root in roots:
        p = Path(root)
        assert p.is_absolute(), str(root)
        if p.exists():  # cd-drives exist as a root, but not as fs item
            assert p.is_dir(), str(root)


@pytest.mark.skipif(not sys.platform.startswith("linux"), reason="for linux only")
def test_get_root_paths_linux():
    assert get_root_paths() == ["/", "/home"]


@pytest.mark.skipif(not sys.platform.startswith("darwin"), reason="for darwin only")
def test_get_root_paths_darwin():
    assert get_root_paths() == ["/", "/Users", "/Volumes"]
