package gateway import ( "testing" "github.com/rose_cat707/luminary/internal/model" "github.com/rose_cat707/luminary/internal/provider" ) func TestIsHealthCheckHTTPStatus(t *testing.T) { cases := map[int]bool{ 200: true, 204: true, 400: true, 422: true, 401: false, 404: false, 500: false, } for code, want := range cases { if got := isHealthCheckHTTPStatus(code); got != want { t.Fatalf("code %d: got %v want %v", code, got, want) } } } func TestHealthCheckEndpointsEmbedding(t *testing.T) { s := &Service{} p := &model.Provider{ Category: model.CategoryEmbedding, Type: model.ProviderOpenAI, AllowedEndpointsJSON: `["embeddings"]`, } eps := s.healthCheckEndpoints(p) if len(eps) != 1 || eps[0] != provider.EndpointEmbeddings { t.Fatalf("got %v", eps) } } func TestHealthCheckEndpointsEmbeddingWithListModels(t *testing.T) { s := &Service{} p := &model.Provider{ Category: model.CategoryEmbedding, Type: model.ProviderOpenAI, AllowedEndpointsJSON: `["list_models","embeddings"]`, } eps := s.healthCheckEndpoints(p) if len(eps) != 2 || eps[0] != provider.EndpointListModels || eps[1] != provider.EndpointEmbeddings { t.Fatalf("got %v", eps) } }