mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
ec65847d0c
chore: include more properties in status model for better compatibility
28 lines
653 B
Go
28 lines
653 B
Go
package helpers
|
|
|
|
import (
|
|
"github.com/muety/wakapi/models"
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestResolveMaximumRange_Default(t *testing.T) {
|
|
for i := 1; i <= 366; i++ {
|
|
err1, maximumInterval := ResolveMaximumRange(i)
|
|
err2, from, to := ResolveIntervalTZ(maximumInterval, time.UTC)
|
|
|
|
assert.Nil(t, err1)
|
|
assert.Nil(t, err2)
|
|
assert.LessOrEqual(t, to.Sub(from), time.Duration(i*24)*time.Hour)
|
|
}
|
|
}
|
|
|
|
func TestResolveMaximumRange_EdgeCases(t *testing.T) {
|
|
err, _ := ResolveMaximumRange(0)
|
|
assert.NotNil(t, err)
|
|
|
|
_, maximumInterval := ResolveMaximumRange(-1)
|
|
assert.Equal(t, models.IntervalAny, maximumInterval)
|
|
}
|