recommend_test.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/mcn/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoAddMcnUpRecommend(t *testing.T) {
  9. convey.Convey("AddMcnUpRecommend", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. arg = &model.McnUpRecommendPool{}
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. rows, err := d.AddMcnUpRecommend(c, arg)
  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 TestDaoDelMcnUpRecommendPool(t *testing.T) {
  24. convey.Convey("DelMcnUpRecommendPool", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. rows, err := d.DelMcnUpRecommendPool(c)
  30. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. ctx.So(rows, convey.ShouldNotBeNil)
  33. })
  34. })
  35. })
  36. }
  37. func TestDaoDelMcnUpRecommendSource(t *testing.T) {
  38. convey.Convey("DelMcnUpRecommendSource", t, func(ctx convey.C) {
  39. var (
  40. c = context.Background()
  41. id = int64(0)
  42. )
  43. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  44. rows, err := d.DelMcnUpRecommendSource(c, id)
  45. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. ctx.So(rows, convey.ShouldNotBeNil)
  48. })
  49. })
  50. })
  51. }
  52. func TestDaoMcnUpRecommendSources(t *testing.T) {
  53. convey.Convey("McnUpRecommendSources", t, func(ctx convey.C) {
  54. var (
  55. c = context.Background()
  56. limit = 100
  57. )
  58. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  59. rps, err := d.McnUpRecommendSources(c, limit)
  60. ctx.Convey("Then err should be nil.rps should not be nil.", func(ctx convey.C) {
  61. ctx.So(err, convey.ShouldBeNil)
  62. ctx.So(len(rps), convey.ShouldBeGreaterThanOrEqualTo, 0)
  63. })
  64. })
  65. })
  66. }