package app import ( "encoding/json" "testing" "git.k8s-git-k6n.net/mats/fancy-dns/internal/config" ) func TestLinksAreServedToTheConsole(t *testing.T) { h := newHarness(t, func(c *config.Config) { c.API.Links.Grafana = "https://grafana.example/d/dns" c.API.Links.Logs = "https://grafana.example/explore" }) code, body := h.get("/api/links") if code != 200 { t.Fatalf("GET /api/links = %d: %s", code, body) } var got config.Links if err := json.Unmarshal(body, &got); err != nil { t.Fatal(err) } if got.Grafana != "https://grafana.example/d/dns" || got.Logs == "" || got.Metrics != "" { t.Fatalf("links = %+v", got) } requireKeys(t, "GET /api/links", keysOf(t, body), wantKeys("grafana", "logs", "metrics")) }