Files
llmgw/internal/web/account_test.go
Ilker ManapandClaude Opus 5 082d52bc97
CI / test (push) Successful in 1m23s
Stop shipping a placeholder that looks like a value, and say what is served
A user copied the curl from the profile page and sent it as it stood. Every
other field in that snippet is filled in for them — the base URL, the key
they had just been issued — so "model": "MODEL" reads as a value rather
than a blank, and they got:

  no endpoint serves "MODEL"

which is true and useless. It reads the same whether the name was a typo,
a placeholder left in from the documentation, or a real outage, and it
never says what would have worked.

The message now lists what is being served, capped at ten with a count for
the rest, and says plainly when nothing is. That list is what /v1/models
already returns to the same caller, so it discloses nothing new.

The profile page's example now names a model that is actually running,
real ones before simulated — the point of an example someone can run is
that it runs, and sending a first request to the sim engine would answer
in Greek letters. The landing and claim pages keep a placeholder, because
they are served without a key and deliberately say nothing about what is
here; theirs is <model-name>, which cannot be mistaken for a value, with a
line saying where to get the real one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 18:23:19 +02:00

22 lines
820 B
Go

package web
import "testing"
func TestTheExampleNamesARealModel(t *testing.T) {
// Every other field in that curl is filled in — the base URL, the key —
// so the one placeholder in it reads like a value. It was copied verbatim
// and sent as the literal string MODEL.
p := &AccountPages{}
if got := p.exampleModel(); got != "<model-name>" {
t.Errorf("with no source the example should be an obvious placeholder, got %q", got)
}
p.ServedModels(func() []string { return nil })
if got := p.exampleModel(); got != "<model-name>" {
t.Errorf("with nothing served the example should be a placeholder, got %q", got)
}
p.ServedModels(func() []string { return []string{"qwen", "big-model"} })
if got := p.exampleModel(); got != "qwen" {
t.Errorf("example model = %q, want the first served name", got)
}
}