package backend

import (
	"strings"
	"testing"
)

func TestComposeImageExtractPromptDefaultBase(t *testing.T) {
	got := ComposeImageExtractPrompt("")
	if !strings.Contains(got, `"caption_zh"`) {
		t.Fatalf("default prompt body missing: %q", got)
	}
	if !strings.Contains(got, `"attributes"`) {
		t.Fatalf("default prompt should document the attributes field: %q", got)
	}
	if !strings.HasSuffix(got, imageAttributesSuffix) {
		t.Fatalf("attributes suffix missing: %q", got)
	}
	if count := strings.Count(got, `"attributes"`); count != 1 {
		t.Fatalf("attributes contract declared %d times, want 1", count)
	}
	if !strings.Contains(imageAttributesSuffix, "at most 30") {
		t.Fatal("attributes suffix missing the 30-attribute limit")
	}
}

func TestComposeImageExtractPromptTenantBase(t *testing.T) {
	got := ComposeImageExtractPrompt("custom tenant prompt")
	want := "custom tenant prompt" + imageAttributesSuffix
	if got != want {
		t.Fatalf("got %q, want %q", got, want)
	}
}
