"""Tests for the task-oriented capability index."""

from __future__ import annotations

from infra_core.capabilities import CAPABILITIES, find_capabilities


def test_find_capabilities_returns_all_for_empty_query() -> None:
    assert find_capabilities("") == list(CAPABILITIES)


def test_find_capabilities_matches_polling_tasks() -> None:
    matches = find_capabilities("poll async job status")

    assert matches
    assert matches[0].slug == "status-polling"


def test_find_capabilities_matches_azure_storage_terms() -> None:
    matches = find_capabilities("azure blob upload")
    slugs = {capability.slug for capability in matches}

    assert "azure-blob-storage" in slugs
