date_statia_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package charge
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestChargeInsertStatisTable(t *testing.T) {
  8. convey.Convey("InsertStatisTable", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. table = "av_charge_daily_statis"
  12. vals = "(100,1,'100-200',100,1,'2018-06-24')"
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. rows, err := d.InsertStatisTable(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 TestChargeDelStatisTable(t *testing.T) {
  24. convey.Convey("DelStatisTable", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. table = "av_charge_daily_statis"
  28. date = "2018-06-24"
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. rows, err := d.DelStatisTable(c, table, date)
  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. }