channel_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/space/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_Channel(t *testing.T) {
  9. Convey("test channel", t, WithService(func(s *Service) {
  10. mid := int64(27515260)
  11. cid := int64(37)
  12. res, err := s.Channel(context.Background(), mid, cid)
  13. So(err, ShouldBeNil)
  14. Printf("res %+v", res)
  15. So(res, ShouldHaveSameTypeAs, &model.Channel{})
  16. }))
  17. }
  18. func TestService_ChannelIndex(t *testing.T) {
  19. Convey("test channel index", t, WithService(func(s *Service) {
  20. mid := int64(27515260)
  21. isGuest := false
  22. res, err := s.ChannelIndex(context.Background(), mid, isGuest)
  23. So(err, ShouldBeNil)
  24. for _, v := range res {
  25. Printf("res %+v", v)
  26. }
  27. var sample []*model.ChannelDetail
  28. So(res, ShouldHaveSameTypeAs, sample)
  29. }))
  30. }
  31. func TestService_ChannelList(t *testing.T) {
  32. Convey("test channel list", t, WithService(func(s *Service) {
  33. mid := int64(27515260)
  34. isGuest := false
  35. res, err := s.ChannelList(context.Background(), mid, isGuest)
  36. So(err, ShouldBeNil)
  37. for _, v := range res {
  38. Printf("res %+v", v)
  39. }
  40. var sample []*model.Channel
  41. So(res, ShouldHaveSameTypeAs, sample)
  42. }))
  43. }
  44. func TestService_DelChannel(t *testing.T) {
  45. Convey("del channel", t, WithService(func(s *Service) {
  46. mid := int64(27515260)
  47. cid := int64(34)
  48. err := s.DelChannel(context.Background(), mid, cid)
  49. So(err, ShouldBeNil)
  50. }))
  51. }