Files
grom/internal/app/fetch_test.go
T
Aleks Petrov e2c65d426e chore: rename project grot -> grom
Grafana's mascot and AI helper are both named Grot
(grafana.com/grot) — a name collision flagged on the r/grafana
launch thread. grom (Polish: thunder) keeps the short Slavic name
without squatting on Grafana's brand.

Renames the Go module, cmd dir, binary, brew cask, docs, examples,
and dev docs. Old repo URL redirects; module path is new as of
v0.2.0.
2026-07-09 18:21:43 +02:00

32 lines
1.0 KiB
Go

package app
import (
"testing"
"github.com/qf-studio/grom/internal/config"
)
func TestUseRange(t *testing.T) {
q := config.Query{}
qi := config.Query{Instant: true}
tests := []struct {
name string
spec config.WidgetSpec
q config.Query
want bool
}{
{"timeseries", config.WidgetSpec{Type: config.TypeTimeSeries}, q, true},
{"timeseries instant opt-out", config.WidgetSpec{Type: config.TypeTimeSeries}, qi, false},
{"plain stat", config.WidgetSpec{Type: config.TypeStat}, q, false},
{"sparkline stat", config.WidgetSpec{Type: config.TypeStat, Sparkline: true}, q, true},
{"sparkline stat instant opt-out", config.WidgetSpec{Type: config.TypeStat, Sparkline: true}, qi, false},
{"gauge ignores sparkline", config.WidgetSpec{Type: config.TypeGauge, Sparkline: true}, q, false},
{"bargauge", config.WidgetSpec{Type: config.TypeBarGauge}, q, false},
}
for _, tt := range tests {
if got := useRange(tt.spec, tt.q); got != tt.want {
t.Errorf("%s: useRange = %v, want %v", tt.name, got, tt.want)
}
}
}