recommend_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/mcn/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestServiceRecommendAdd(t *testing.T) {
  9. convey.Convey("RecommendAdd", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. arg = &model.RecommendUpReq{}
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. err := s.RecommendAdd(c, arg)
  16. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestServiceRecommendOP(t *testing.T) {
  23. convey.Convey("RecommendOP", t, func(ctx convey.C) {
  24. var (
  25. c = context.Background()
  26. arg = &model.RecommendStateOpReq{}
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. err := s.RecommendOP(c, arg)
  30. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestServiceRecommendList(t *testing.T) {
  37. convey.Convey("RecommendList", t, func(ctx convey.C) {
  38. var (
  39. c = context.Background()
  40. arg = &model.MCNUPRecommendReq{}
  41. )
  42. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  43. res, err := s.RecommendList(c, arg)
  44. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. ctx.So(res, convey.ShouldNotBeNil)
  47. })
  48. })
  49. })
  50. }