grpc_test.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoElecMonthRank(t *testing.T) {
  8. convey.Convey("ElecMonthRank", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. avID = int64(0)
  12. upMID = int64(0)
  13. rankSize = int(0)
  14. )
  15. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  16. resp, err := d.RankElecMonth(c, avID, upMID, rankSize)
  17. ctx.Convey("Then err should be nil.rank should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(resp, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoElecMonthRankUP(t *testing.T) {
  25. convey.Convey("ElecMonthRankUP", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. upMID = int64(0)
  29. rankSize = int(0)
  30. )
  31. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  32. rank, err := d.RankElecMonthUP(c, upMID, rankSize)
  33. ctx.Convey("Then err should be nil.rank should not be nil.", func(ctx convey.C) {
  34. ctx.So(err, convey.ShouldBeNil)
  35. ctx.So(rank, convey.ShouldNotBeNil)
  36. })
  37. })
  38. })
  39. }
  40. func TestDaoElecTotalRankAV(t *testing.T) {
  41. convey.Convey("ElecTotalRankAV", t, func(ctx convey.C) {
  42. var (
  43. c = context.Background()
  44. upMID = int64(0)
  45. avID = int64(0)
  46. rankSize = int(0)
  47. )
  48. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  49. rank, err := d.RankElecAllAV(c, upMID, avID, rankSize)
  50. ctx.Convey("Then err should be nil.rank should not be nil.", func(ctx convey.C) {
  51. ctx.So(err, convey.ShouldBeNil)
  52. ctx.So(rank, convey.ShouldNotBeNil)
  53. })
  54. })
  55. })
  56. }