income_date_statis_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package income
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestIncomeInsertIncomeStatisTable(t *testing.T) {
  8. convey.Convey("InsertIncomeStatisTable", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. table = "av_income_daily_statis"
  12. vals = "(1,2,'100-200',100,1,'2018-06-24')"
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. rows, err := d.InsertIncomeStatisTable(c, table, vals)
  16. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(rows, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestIncomeInsertUpIncomeDailyStatis(t *testing.T) {
  24. convey.Convey("InsertUpIncomeDailyStatis", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. table = "up_income_daily_statis"
  28. vals = "(10,1,'100-200',1,'2018-06-24')"
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. rows, err := d.InsertUpIncomeDailyStatis(c, table, vals)
  32. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(rows, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestIncomeDelIncomeStatisTable(t *testing.T) {
  40. convey.Convey("DelIncomeStatisTable", t, func(ctx convey.C) {
  41. var (
  42. c = context.Background()
  43. table = "av_income_daily_statis"
  44. date = "2018-06-24"
  45. )
  46. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  47. rows, err := d.DelIncomeStatisTable(c, table, date)
  48. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  49. ctx.So(err, convey.ShouldBeNil)
  50. ctx.So(rows, convey.ShouldNotBeNil)
  51. })
  52. })
  53. })
  54. }