bgm_test.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package income
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestIncomeInsertBGM(t *testing.T) {
  8. convey.Convey("InsertBGM", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. values = "(1,2,3,4,'2018-06-24','test')"
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. rows, err := d.InsertBGM(c, values)
  15. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(rows, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestIncomeGetBGM(t *testing.T) {
  23. convey.Convey("GetBGM", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. id = int64(0)
  27. limit = int64(100)
  28. )
  29. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  30. bs, last, err := d.GetBGM(c, id, limit)
  31. ctx.Convey("Then err should be nil.bs,last should not be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldBeNil)
  33. ctx.So(last, convey.ShouldNotBeNil)
  34. ctx.So(bs, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestIncomeDelBGM(t *testing.T) {
  40. convey.Convey("DelBGM", t, func(ctx convey.C) {
  41. var (
  42. c = context.Background()
  43. limit = int64(100)
  44. )
  45. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  46. rows, err := d.DelBGM(c, limit)
  47. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. ctx.So(rows, convey.ShouldNotBeNil)
  50. })
  51. })
  52. })
  53. }