"""Tests para strip_markdown_codeblock."""

import sys
import os

sys.path.insert(0, os.path.dirname(__file__))

from strip_markdown_codeblock import strip_markdown_codeblock


def test_JSON_sin_codeblock_no_cambia():
    result = strip_markdown_codeblock('{"key": "value"}')
    assert result == '{"key": "value"}'


def test_JSON_con_wrapper_json_es_desenvuelto():
    result = strip_markdown_codeblock('```json\n{"key": "value"}\n```')
    assert result == '{"key": "value"}'


def test_JSON_con_wrapper_solo_es_desenvuelto():
    result = strip_markdown_codeblock('```\n{"key": "value"}\n```')
    assert result == '{"key": "value"}'


def test_texto_que_no_es_JSON_pasa_sin_cambio():
    result = strip_markdown_codeblock("hello world")
    assert result == "hello world"
