package service

import (
	"strings"
	"testing"

	"oci-portal/internal/oci"
)

// TestSupportedGatewayModels 断言 CHAT 目录仅保留兼容面厂商,EMBEDDING 不受影响。
func TestSupportedGatewayModels(t *testing.T) {
	in := []oci.GenAiModel{
		{Name: "xai.grok-4.3", Capability: "CHAT"},
		{Name: "meta.llama-4-maverick-17b-128e", Capability: "CHAT"},
		{Name: "openai.gpt-oss-120b", Capability: "CHAT"},
		{Name: "google.gemini-2.5-flash", Capability: "CHAT"},
		{Name: "cohere.command-a-03-2025", Capability: "CHAT"},
		{Name: "cohere.embed-v4.0", Capability: "EMBEDDING"},
	}
	out := supportedGatewayModels(in)
	names := make([]string, 0, len(out))
	for _, m := range out {
		names = append(names, m.Name)
	}
	want := "xai.grok-4.3,meta.llama-4-maverick-17b-128e,openai.gpt-oss-120b,cohere.embed-v4.0"
	if got := strings.Join(names, ","); got != want {
		t.Fatalf("过滤结果 = %s, want %s", got, want)
	}
}
