23 lines
415 B
Go
23 lines
415 B
Go
package analytics
|
|
|
|
import "testing"
|
|
|
|
func TestValidIntervals(t *testing.T) {
|
|
tests := []struct {
|
|
interval string
|
|
want bool
|
|
}{
|
|
{"day", true},
|
|
{"week", true},
|
|
{"month", true},
|
|
{"year", false},
|
|
{"", false},
|
|
{"DAY", false},
|
|
}
|
|
for _, tt := range tests {
|
|
if got := validIntervals[tt.interval]; got != tt.want {
|
|
t.Errorf("validIntervals[%q] = %v, want %v", tt.interval, got, tt.want)
|
|
}
|
|
}
|
|
}
|