favorite_test.go 724 B

12345678910111213141516171819202122232425262728293031
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestService_AddFav(t *testing.T) {
  8. Convey("test service addfav", t, WithService(func(s *Service) {
  9. err := s.AddFav(context.Background(), 180, 3)
  10. So(err, ShouldBeNil)
  11. }))
  12. }
  13. func TestService_DelFav(t *testing.T) {
  14. Convey("test service delfav", t, WithService(func(s *Service) {
  15. err := s.DelFav(context.Background(), 180, 0)
  16. So(err, ShouldBeNil)
  17. }))
  18. }
  19. func TestService_ListFav(t *testing.T) {
  20. Convey("test service listfav", t, WithService(func(s *Service) {
  21. res, count, err := s.ListFav(context.Background(), 10, 10, 1, 10)
  22. So(err, ShouldBeNil)
  23. So(len(res), ShouldBeGreaterThan)
  24. println(count)
  25. }))
  26. }