package runner

import (
	"testing"

	"github.com/easyai/easyai-ai-gateway/apps/api/internal/store"
)

func TestKelingO1GeneratedAudioIsRejectedInsteadOfSilentlyRemoved(t *testing.T) {
	result := preprocessRequestWithLog("videos.generations", map[string]any{
		"model": "kling-o1",
		"audio": true,
	}, store.RuntimeModelCandidate{
		Provider:          "keling",
		ProviderModelName: "kling-video-o1",
		ModelType:         "video_generate",
		Capabilities: map[string]any{
			"video_generate": map[string]any{"output_audio": false},
		},
	})
	if result.Err == nil {
		t.Fatal("Keling O1 audio=true must be rejected")
	}
	if len(result.Log.Changes) == 0 || result.Log.Changes[len(result.Log.Changes)-1].Action != "reject" {
		t.Fatalf("expected an auditable reject change, got %+v", result.Log.Changes)
	}
}
