"""Smoke test — celery runs the ping task in eager mode (no broker required)."""

import pytest

from backend.app.celery_app import celery
from backend.app.tasks.smoke import ping


@pytest.fixture(autouse=True)
def celery_eager():
    celery.conf.task_always_eager = True
    celery.conf.task_eager_propagates = True
    yield
    celery.conf.task_always_eager = False


def test_ping_returns_pong():
    result = ping.delay()
    assert result.get(timeout=1) == "pong"


def test_ping_with_value():
    result = ping.delay("hello")
    assert result.get(timeout=1) == "hello"
