# Path: app/services/friends_chain.py
# class _Node:
# class _Tree(dict):
#     def __init__(self, user_id: int, parents: List[int] = None):
#     def id(self) -> int:
#     def parents(self) -> List[int]:
#     def add(self, node: _Node):
#     def get_by_id(self, user_id: int) -> _Node:
#     def is_id_exists(self, user_id: int):
#     def nodes(self) -> List[_Node]:
# def _build_tree(root_id: int, max_depth: SupportsInt) -> _Tree:
#     def add_next_level(prev_level: List[int], depth: int, parents: List[int]):
# def _find_common_friend(root_id: int, tree: _Tree,
#                         max_depth: SupportsInt) -> Optional[List[int]]:
#     def check_next_level(prev_level: List[int], depth: int,
#                          parents: List[int]) -> Optional[List[int]]:
# def find_chain(user1: int, user2: int,
#                max_length: int = 5) -> Optional[List[int]]:


from unittest.mock import MagicMock
from app.services import friends_chain


user1 = 1
user2 = 2


def test_empty_chain():
    friends_chain.vk.get_friends_ids = MagicMock(return_value=[user2])
    
    chain = friends_chain.find_chain(user1, user2)

    assert chain == []


def test_chain_through_one():

# Path: app/services/friends_chain.py
# class _Node:
# class _Tree(dict):
#     def __init__(self, user_id: int, parents: List[int] = None):
#     def id(self) -> int:
#     def parents(self) -> List[int]:
#     def add(self, node: _Node):
#     def get_by_id(self, user_id: int) -> _Node:
#     def is_id_exists(self, user_id: int):
#     def nodes(self) -> List[_Node]:
# def _build_tree(root_id: int, max_depth: SupportsInt) -> _Tree:
#     def add_next_level(prev_level: List[int], depth: int, parents: List[int]):
# def _find_common_friend(root_id: int, tree: _Tree,
#                         max_depth: SupportsInt) -> Optional[List[int]]:
#     def check_next_level(prev_level: List[int], depth: int,
#                          parents: List[int]) -> Optional[List[int]]:
# def find_chain(user1: int, user2: int,
#                max_length: int = 5) -> Optional[List[int]]:


# Path: tests/friends_chain_test.py
from unittest.mock import MagicMock
from app.services import friends_chain



user1 = 1
user2 = 2


def test_empty_chain():
    friends_chain.vk.get_friends_ids = MagicMock(return_value=[user2])
    
    chain = friends_chain.find_chain(user1, user2)

    assert chain == []


def test_chain_through_one():

    friends_chain.vk.get_friends_ids = MagicMock(return_value=[])