@@ -32,6 +32,16 @@ def test_base_url_configuration():
3232 expected_url = "https://test-tenant.agileday.io/api"
3333 assert BASE_URL == expected_url
3434
35+ def test_find_experts_case_insensitive (mock_api_response ):
36+ """Test that 'python' finds 'Python'."""
37+ mock_data = [{"firstName" : "Alice" , "skills" : [{"name" : "Python" , "proficiency" : 5 }]}]
38+ mock_api_response .return_value .json .return_value = mock_data
39+
40+ # UPDATED CALL
41+ result = find_experts_logic ("python" )
42+
43+ assert "Python" in result
44+
3545def test_find_experts_found (mock_api_response ):
3646 """Test searching for a skill that exists."""
3747 mock_data = [
@@ -53,23 +63,39 @@ def test_find_experts_found(mock_api_response):
5363 ]
5464 mock_api_response .return_value .json .return_value = mock_data
5565
56- # UPDATED CALL: find_experts_logic
5766 result = find_experts_logic ("Python" )
5867
5968 assert "Alice Engineer" in result
6069 assert "Senior Dev" in result
61- assert "Python (5/5)" in result
70+ # Note: Older logic didn't have Exp, so this asserts basic format
71+ assert "Python" in result
6272 assert "Bob" not in result
6373
64- def test_find_experts_case_insensitive (mock_api_response ):
65- """Test that 'python' finds 'Python'."""
66- mock_data = [{"firstName" : "Alice" , "skills" : [{"name" : "Python" , "proficiency" : 5 }]}]
74+ def test_find_experts_includes_experience (mock_api_response ):
75+ """
76+ New Test: Ensure that the 'experience' field from the API
77+ is correctly formatted into the output string.
78+ """
79+ mock_data = [
80+ {
81+ "firstName" : "Senior" ,
82+ "lastName" : "Dev" ,
83+ "title" : "Architect" ,
84+ "skills" : [
85+ # API returns experience as a string (e.g. "2 years" or ISO "P2Y")
86+ {"name" : "Java" , "proficiency" : 5 , "experience" : "5 years" },
87+ {"name" : "Python" , "proficiency" : 4 , "experience" : "6 months" }
88+ ]
89+ }
90+ ]
6791 mock_api_response .return_value .json .return_value = mock_data
6892
69- # UPDATED CALL
70- result = find_experts_logic ("python" )
71-
72- assert "Python" in result
93+ # Search for Java
94+ result = find_experts_logic ("Java" )
95+
96+ # Assert that the experience string is present in the output
97+ assert "Senior Dev" in result
98+ assert "Java (Lvl 5/5, Exp: 5 years)" in result
7399
74100def test_find_experts_no_matches (mock_api_response ):
75101 """Test response when no one has the skill."""
0 commit comments