snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
build / build (push) Failing after 3s
Some checks failed
build / build (push) Failing after 3s
This commit is contained in:
23
time/interval_test.go
Normal file
23
time/interval_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package time
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/traggo/server/generated/gqlmodel"
|
||||
"github.com/traggo/server/model"
|
||||
)
|
||||
|
||||
func TestInterval(t *testing.T) {
|
||||
for _, inter := range []model.Interval{
|
||||
model.IntervalSingle, model.IntervalHourly, model.IntervalDaily, model.IntervalWeekly, model.IntervalMonthly, model.IntervalYearly,
|
||||
} {
|
||||
assert.Equal(t, inter, InternalInterval(ExternalInterval(inter)))
|
||||
}
|
||||
assert.Panics(t, func() {
|
||||
InternalInterval(gqlmodel.StatsInterval("meh"))
|
||||
})
|
||||
assert.Panics(t, func() {
|
||||
ExternalInterval(model.Interval("meh"))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user