Files
Luminary/internal/gateway/model_resolve_test.go
T
renjue 76ba500417
CI / docker (push) Successful in 2m4s
Initial commit: Luminary AI Gateway
OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress,
ingress key governance, monitoring, and security controls.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 21:46:16 +08:00

33 lines
803 B
Go

package gateway
import (
"encoding/json"
"testing"
"github.com/rose_cat707/luminary/internal/model"
)
func TestIngressModelID(t *testing.T) {
if got := IngressModelID(model.ModelEntry{ModelID: "text-embedding-3-small", Alias: "my-embed"}); got != "my-embed" {
t.Fatalf("got %q", got)
}
if got := (model.ModelEntry{ModelID: "gpt-4o"}).IngressID(); got != "gpt-4o" {
t.Fatalf("got %q", got)
}
}
func TestRewriteModelInBody(t *testing.T) {
body := []byte(`{"model":"my-embed","input":"hi"}`)
out, err := rewriteModelInBody(body, "text-embedding-3-small")
if err != nil {
t.Fatal(err)
}
var payload map[string]string
if err := json.Unmarshal(out, &payload); err != nil {
t.Fatal(err)
}
if payload["model"] != "text-embedding-3-small" {
t.Fatalf("got %q", payload["model"])
}
}