invite_test.go 526 B

1234567891011121314151617181920212223
  1. package http
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. )
  6. const (
  7. _outFormat = "2006-01-02 15:04:05"
  8. )
  9. func TestInit(t *testing.T) {
  10. Convey("range when from str equal to to str", t, func() {
  11. fromStr := "2017-12-25"
  12. toStr := "2017-12-25"
  13. from, to, ok := rangeDate(fromStr, toStr)
  14. So(ok, ShouldEqual, true)
  15. So(from.Format(_outFormat), ShouldEqual, "2017-12-25 00:00:00")
  16. So(to.Format(_outFormat), ShouldEqual, "2017-12-25 23:59:59")
  17. So(to.Unix()-from.Unix(), ShouldEqual, 86399)
  18. })
  19. }