def METHOD_NAME(
    search: str,
    expected_names: list[str],
    database: AllRepositories,
    search_units: list[IngredientUnit],  # required so database is populated
    unique_local_group_id: str,
):
    repo = database.ingredient_units.by_group(unique_local_group_id)
    pagination = PaginationQuery(page=1, per_page=-1, order_by="created_at", order_direction=OrderDirection.asc)
    results = repo.page_all(pagination, search=search).items
    if len(expected_names) == 0:
        assert len(results) == 0
    else:
        # if more results are returned, that's acceptable, as long as they are ranked correctly
        assert len(results) >= len(expected_names)
        for unit, name in zip(results, expected_names, strict=False):
            assert unit.name == name