package anthropic

import "testing"

func TestConvertOpenAIContentBlocks_TextAndImage(t *testing.T) {
	content := []any{
		map[string]any{"type": "text", "text": "describe this"},
		map[string]any{"type": "image_url", "image_url": map[string]any{"url": "https://example.com/a.png"}},
	}
	blocks, ok := convertOpenAIContentBlocks(content).([]map[string]any)
	if !ok || len(blocks) != 2 {
		t.Fatalf("expected 2 blocks, got %#v", convertOpenAIContentBlocks(content))
	}
	if blocks[0]["text"] != "describe this" {
		t.Fatalf("unexpected text block: %#v", blocks[0])
	}
	if blocks[1]["type"] != "image" {
		t.Fatalf("unexpected image block: %#v", blocks[1])
	}
}

func TestExtractOpenAIContent_String(t *testing.T) {
	if got := extractOpenAIContent("hello"); got != "hello" {
		t.Fatalf("got %q", got)
	}
}
