top_arc_test.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaotopArcHit(t *testing.T) {
  8. convey.Convey("topArcHit", t, func(ctx convey.C) {
  9. var (
  10. mid = int64(5551)
  11. )
  12. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  13. p1 := topArcHit(mid)
  14. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaotopArcKey(t *testing.T) {
  21. convey.Convey("topArcKey", t, func(ctx convey.C) {
  22. var (
  23. mid = int64(5551)
  24. )
  25. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  26. p1 := topArcKey(mid)
  27. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  28. ctx.So(p1, convey.ShouldNotBeNil)
  29. })
  30. })
  31. })
  32. }
  33. func TestDaoRawTopArc(t *testing.T) {
  34. convey.Convey("RawTopArc", t, func(ctx convey.C) {
  35. var (
  36. c = context.Background()
  37. mid = int64(2089809)
  38. )
  39. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  40. res, err := d.RawTopArc(c, mid)
  41. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. ctx.So(res, convey.ShouldNotBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestDaoAddTopArc(t *testing.T) {
  49. convey.Convey("AddTopArc", t, func(ctx convey.C) {
  50. var (
  51. c = context.Background()
  52. mid = int64(5551)
  53. aid = int64(170001)
  54. reason = "aaaa"
  55. )
  56. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  57. err := d.AddTopArc(c, mid, aid, reason)
  58. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestDaoDelTopArc(t *testing.T) {
  65. convey.Convey("DelTopArc", t, func(ctx convey.C) {
  66. var (
  67. c = context.Background()
  68. mid = int64(5551)
  69. )
  70. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  71. err := d.DelTopArc(c, mid)
  72. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  73. ctx.So(err, convey.ShouldBeNil)
  74. })
  75. })
  76. })
  77. }