notice_test.go 996 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func Test_InsertNotice(t *testing.T) {
  8. title := "公告标题"
  9. typ, platform, status := 0, 1, 0
  10. link := "www.bilibili.com"
  11. Convey("admins", t, WithService(func(s *Service) {
  12. err := s.InsertNotice(context.Background(), title, typ, platform, link, status)
  13. So(err, ShouldBeNil)
  14. }))
  15. }
  16. func Test_Notices(t *testing.T) {
  17. typ, platform, status := 0, 1, 0
  18. from, limit := 0, 1000
  19. Convey("admins", t, WithService(func(s *Service) {
  20. _, res, err := s.Notices(context.Background(), typ, status, platform, from, limit)
  21. So(err, ShouldBeNil)
  22. So(len(res), ShouldBeGreaterThan, 0)
  23. }))
  24. }
  25. func Test_UpdateNotice(t *testing.T) {
  26. title := "公告标题"
  27. typ, platform, status, id := 0, 1, 0, int64(0)
  28. link := "www.bilibili.com"
  29. Convey("admins", t, WithService(func(s *Service) {
  30. err := s.UpdateNotice(context.Background(), typ, platform, title, link, id, status)
  31. So(err, ShouldBeNil)
  32. }))
  33. }