"""Unit tests for peerdrop/constants.py."""

from pathlib import Path

from peerdrop.constants import DEFAULT_SOCK_PATH, DEFAULT_PID_PATH, DEFAULT_DOWNLOAD_DIR


class TestDefaultSockPath:
    def test_is_path_object(self):
        assert isinstance(DEFAULT_SOCK_PATH, Path)

    def test_expanded(self):
        assert "~" not in str(DEFAULT_SOCK_PATH)

    def test_ends_with_sock(self):
        assert str(DEFAULT_SOCK_PATH).endswith("peerdrop.sock")

    def test_in_peerdrop_dir(self):
        assert ".peerdrop" in str(DEFAULT_SOCK_PATH)


class TestDefaultPidPath:
    def test_is_path_object(self):
        assert isinstance(DEFAULT_PID_PATH, Path)

    def test_expanded(self):
        assert "~" not in str(DEFAULT_PID_PATH)

    def test_ends_with_pid(self):
        assert str(DEFAULT_PID_PATH).endswith("peerdrop.pid")

    def test_same_dir_as_sock(self):
        assert DEFAULT_PID_PATH.parent == DEFAULT_SOCK_PATH.parent


class TestDefaultDownloadDir:
    def test_is_string(self):
        assert isinstance(DEFAULT_DOWNLOAD_DIR, str)

    def test_contains_tilde(self):
        assert "~" in DEFAULT_DOWNLOAD_DIR

    def test_contains_peerdrop(self):
        assert "peerdrop" in DEFAULT_DOWNLOAD_DIR
