Files
2026-10-08 16:50:13 +08:00

28 lines
841 B
Go

package sysconfdata
import (
"testing"
"91jd-server/models/v/sysconfmod"
)
func TestTotalWatchCount(t *testing.T) {
tests := []struct {
name string
config sysconfmod.ConfMap
want uint64
}{
{name: "configured", config: sysconfmod.ConfMap{string(sysconfmod.VCodeTotalWatchCount): "5"}, want: 5},
{name: "zero is allowed", config: sysconfmod.ConfMap{string(sysconfmod.VCodeTotalWatchCount): "0"}, want: 0},
{name: "missing", config: sysconfmod.ConfMap{}, want: DefaultTotalWatchCount},
{name: "invalid", config: sysconfmod.ConfMap{string(sysconfmod.VCodeTotalWatchCount): "invalid"}, want: DefaultTotalWatchCount},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := totalWatchCount(tt.config); got != tt.want {
t.Fatalf("totalWatchCount() = %d, want %d", got, tt.want)
}
})
}
}