top_dy_test.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaotopDyHit(t *testing.T) {
  9. convey.Convey("topDyHit", t, func(ctx convey.C) {
  10. var (
  11. mid = int64(666)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. p1 := topDyHit(mid)
  15. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  16. ctx.So(p1, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaotopDyKey(t *testing.T) {
  22. convey.Convey("topDyKey", t, func(ctx convey.C) {
  23. var (
  24. mid = int64(666)
  25. )
  26. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  27. p1 := topDyKey(mid)
  28. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  29. ctx.So(p1, convey.ShouldNotBeNil)
  30. })
  31. })
  32. })
  33. }
  34. func TestDaoRawTopDynamic(t *testing.T) {
  35. convey.Convey("RawTopDynamic", t, func(ctx convey.C) {
  36. var (
  37. c = context.Background()
  38. mid = int64(666)
  39. )
  40. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  41. dyID, err := d.RawTopDynamic(c, mid)
  42. ctx.Convey("Then err should be nil.dyID should not be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. ctx.So(dyID, convey.ShouldNotBeNil)
  45. })
  46. })
  47. })
  48. }
  49. func TestDaoAddTopDynamic(t *testing.T) {
  50. convey.Convey("AddTopDynamic", t, func(ctx convey.C) {
  51. var (
  52. c = context.Background()
  53. mid = int64(666)
  54. dyID = int64(1111111111)
  55. )
  56. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  57. err := d.AddTopDynamic(c, mid, dyID)
  58. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestDaoDelTopDynamic(t *testing.T) {
  65. convey.Convey("DelTopDynamic", t, func(ctx convey.C) {
  66. var (
  67. c = context.Background()
  68. mid = int64(666)
  69. now = time.Now()
  70. )
  71. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  72. err := d.DelTopDynamic(c, mid, now)
  73. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  74. ctx.So(err, convey.ShouldBeNil)
  75. })
  76. })
  77. })
  78. }