lottery_test.go 832 B

123456789101112131415161718192021222324252627282930
  1. package income
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestIncomeGetLotteryIncome(t *testing.T) {
  8. convey.Convey("GetLotteryIncome", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. id = int64(0)
  12. query = ""
  13. from = "2018-01-01"
  14. to = "2019-01-01"
  15. limit = int(2000)
  16. typ = int(5)
  17. )
  18. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  19. Exec(c, "INSERT INTO lottery_av_income(av_id, mid, income, date) VALUES(10010, 1001, 100, '2018-11-11') ONDUPLICATE KEY UPDATE date = '2018-11-11'")
  20. avs, err := d.GetLotteryIncome(c, id, query, from, to, limit, typ)
  21. ctx.Convey("Then err should be nil.avs should not be nil.", func(ctx convey.C) {
  22. ctx.So(err, convey.ShouldBeNil)
  23. ctx.So(avs, convey.ShouldNotBeNil)
  24. })
  25. })
  26. })
  27. }