subtitle_test.go 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/dm2/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestSubtitle(t *testing.T) {
  9. var (
  10. oid int64 = 10109227
  11. subtitleID int64 = 1
  12. )
  13. Convey("", t, func() {
  14. err := svr.SubtitleFilter(context.Background(), oid, subtitleID)
  15. So(err, ShouldBeNil)
  16. })
  17. }
  18. func TestSubtitleFilter(t *testing.T) {
  19. body := &model.SubtitleBody{
  20. Bodys: []*model.SubtitleItem{
  21. {
  22. From: 0,
  23. To: 10,
  24. Content: "习近平",
  25. },
  26. {
  27. From: 0,
  28. To: 10,
  29. Content: "习大大",
  30. },
  31. {
  32. From: 0,
  33. To: 10,
  34. Content: "不要哇",
  35. },
  36. {
  37. From: 0,
  38. To: 10,
  39. Content: "呀咩爹",
  40. },
  41. },
  42. }
  43. Convey("subtitle filter", t, func() {
  44. hits, err := svr.checkFilter(context.Background(), body)
  45. So(err, ShouldBeNil)
  46. t.Logf("hits:%v", hits)
  47. })
  48. }