ZeroBot-Plugin/plugin_manager/timer/timer_test.go
fumiama 0185d0c730 🚚 ⬆️ 📝 🔥 🎨 迁移 ctrl, utils
2022-01-11 11:40:33 +08:00

34 lines
590 B
Go

package timer
import (
"testing"
"time"
"github.com/FloatTech/zbputils/sql"
"github.com/sirupsen/logrus"
)
func TestNextWakeTime(t *testing.T) {
logrus.SetLevel(logrus.DebugLevel)
ts := &Timer{}
ts.SetMonth(-1)
ts.SetWeek(6)
ts.SetHour(16)
ts.SetMinute(30)
t1 := time.Until(ts.nextWakeTime())
if t1 < 0 {
t.Log(t1)
t.Fail()
}
t.Log(t1)
t.Fail()
}
func TestClock(t *testing.T) {
db := &sql.Sqlite{DBPath: "test.db"}
c := NewClock(db)
c.AddTimerIntoDB(GetFilledTimer([]string{"", "12", "-1", "12", "0", "", "test"}, 0, 0, false))
t.Log(c.ListTimers(0))
t.Fail()
}