start project
CI / Backend (lint, types, tests) (push) Has been cancelled
CI / Frontend (lint, types, build) (push) Has been cancelled
CI / Docker images build (push) Has been cancelled

This commit is contained in:
2026-09-04 12:52:21 +03:30
parent a464e550c9
commit 212074c5f5
40 changed files with 2804 additions and 164 deletions
+44
View File
@@ -90,6 +90,50 @@ def test_facets_reflect_the_filtered_result_set(
assert response.data["facets"]["skills"]
def test_selecting_a_facet_value_keeps_its_own_sibling_values_visible(
auth_client, analyst, sample_profiles
) -> None: # noqa: ANN001
"""
Multi-select facets: ticking "Engineering" under Job family must not make
"Human resources" disappear from that same checkbox list - a facet is
scoped by every *other* active filter, never by its own. Every other
facet (country, in ``test_facets_reflect_the_filtered_result_set`` above)
keeps narrowing to the selection as before.
"""
response = search(auth_client(analyst), roles="engineering")
assert sorted(names(response)) == ["maria frontend", "sara python"]
roles = {bucket["key"]: bucket["count"] for bucket in response.data["facets"]["job_title_role"]}
assert roles == {"engineering": 2, "human_resources": 1}
def test_self_exclusion_does_not_ignore_other_active_filters(
auth_client, analyst, sample_profiles
) -> None: # noqa: ANN001
"""
Excluding a facet's own filter must not turn into excluding *all*
filters: with ``roles=engineering`` AND ``countries=germany`` both active,
the job-family facet drops only its own ``roles`` filter and keeps
``countries=germany``. "human_resources" (john, based in the United
States) correctly stays absent here - not because the facet is narrowed by
its own selection, but because no German profile has that role at all.
Contrast with ``test_selecting_a_facet_value_keeps_its_own_sibling_values_visible``,
where the same "human_resources" sibling *does* reappear once
``countries`` is not also constraining the result set.
"""
response = search(auth_client(analyst), roles="engineering", countries="germany")
assert names(response) == ["sara python"]
roles = {bucket["key"] for bucket in response.data["facets"]["job_title_role"]}
assert roles == {"engineering"}
countries = {bucket["key"] for bucket in response.data["facets"]["country"]}
# Scoped by roles=engineering (the other active filter) but not by its
# own countries=germany selection, so spain (maria, also engineering)
# still shows up.
assert countries == {"germany", "spain"}
def test_sorting_by_experience(auth_client, analyst, sample_profiles) -> None: # noqa: ANN001
assert names(search(auth_client(analyst), sort="-experience"))[0] == "john recruiter"
assert names(search(auth_client(analyst), sort="experience"))[0] == "maria frontend"