income_test.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func Test_InsertTagIncome(t *testing.T) {
  9. Convey("growup-job InsertTagIncome", t, WithService(func(s *Service) {
  10. date := time.Now().Add(-24 * time.Hour)
  11. t := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, time.Local)
  12. err := s.InsertTagIncome(context.Background(), t)
  13. So(err, ShouldBeNil)
  14. }))
  15. }
  16. func Test_GetAvIncomeStatis(t *testing.T) {
  17. Convey("growup-job GetAvIncomeStatis", t, WithService(func(s *Service) {
  18. date := time.Now().Add(-24 * time.Hour)
  19. t := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, time.Local)
  20. err := s.GetAvIncomeStatis(context.Background(), t.Format(_layout))
  21. So(err, ShouldBeNil)
  22. }))
  23. }
  24. func Test_GetAvIncomes(t *testing.T) {
  25. Convey("growup-job GetAvIncome", t, WithService(func(s *Service) {
  26. res, err := s.GetAvIncome(context.Background())
  27. So(err, ShouldBeNil)
  28. So(res, ShouldNotBeEmpty)
  29. }))
  30. }
  31. func Test_GetUpIncomeStatis(t *testing.T) {
  32. Convey("growup-job GetUpIncomeStatis", t, WithService(func(s *Service) {
  33. date := time.Now().Add(-24 * time.Hour)
  34. t := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, time.Local)
  35. hasWithdraw := 1
  36. err := s.GetUpIncomeStatis(context.Background(), t.Format(_layout), hasWithdraw)
  37. So(err, ShouldBeNil)
  38. }))
  39. }
  40. func Test_GetUpAccount(t *testing.T) {
  41. Convey("growup-job GetUpAccount", t, WithService(func(s *Service) {
  42. date := time.Now().Add(-24 * time.Hour)
  43. t := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, time.Local)
  44. res, err := s.GetUpAccount(context.Background(), t.Format(_layout), date.Format("2006-01-02 15:04:05"))
  45. So(err, ShouldBeNil)
  46. So(res, ShouldNotBeEmpty)
  47. }))
  48. }
  49. func Test_GetUpIncome(t *testing.T) {
  50. Convey("growup-job GetUpIncome", t, WithService(func(s *Service) {
  51. date := time.Now().Add(-24 * time.Hour)
  52. t := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, time.Local)
  53. table := "up_account"
  54. res, err := s.GetUpIncome(context.Background(), table, t.Format(_layout))
  55. So(err, ShouldBeNil)
  56. So(res, ShouldNotBeEmpty)
  57. }))
  58. }
  59. func Test_GetUpWithdraw(t *testing.T) {
  60. Convey("growup-job GetUpWithdraw", t, WithService(func(s *Service) {
  61. date := time.Now().Add(-24 * time.Hour)
  62. t := time.Date(date.Year(), date.Month(), date.Day(), 0, 0, 0, 0, time.Local)
  63. res, err := s.GetUpWithdraw(context.Background(), t.Format(_layout))
  64. So(err, ShouldBeNil)
  65. So(res, ShouldNotBeEmpty)
  66. }))
  67. }
  68. func Test_GetUpNickname(t *testing.T) {
  69. Convey("growup-job GetUpNickname", t, WithService(func(s *Service) {
  70. mids := []int64{int64(1), int64(2)}
  71. res, err := s.GetUpNickname(context.Background(), mids)
  72. So(err, ShouldBeNil)
  73. So(res, ShouldNotBeEmpty)
  74. }))
  75. }