report_test.go 995 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package gorm
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. "time"
  8. )
  9. func TestGormReportTaskFlow(t *testing.T) {
  10. convey.Convey("ReportTaskFlow", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. metas, _, err := d.ReportTaskMetas(c, "", "", 1, 1, []int64{}, map[int64]string{}, 0)
  16. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. for _, meta := range metas {
  19. fmt.Println("meta:", meta)
  20. }
  21. })
  22. })
  23. })
  24. }
  25. func TestDao_TaskReports(t *testing.T) {
  26. time.Time{}.Unix()
  27. t.Logf("%s", time.Duration(time.Duration(3661)*time.Second).String())
  28. return
  29. convey.Convey("TaskReports", t, func(ctx convey.C) {
  30. res, err := d.TaskReports(cntx, 1, 1, []int8{2, 3, 4}, "2019-01-14", "2019-01-15")
  31. ctx.So(err, convey.ShouldBeNil)
  32. for _, item := range res {
  33. t.Logf("item(%+v)", item)
  34. }
  35. })
  36. }