comment_test.go 683 B

123456789101112131415161718192021222324252627282930
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. "go-common/app/tool/saga/model"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestServiceHandleGitlabComment(t *testing.T) {
  10. convey.Convey("HandleGitlabComment", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. event = &model.HookComment{}
  14. err error
  15. s Service
  16. )
  17. err = json.Unmarshal(GitlabHookCommentTest, event)
  18. convey.So(err, convey.ShouldBeNil)
  19. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  20. err := s.HandleGitlabComment(c, event)
  21. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  22. ctx.So(err, convey.ShouldBeNil)
  23. })
  24. })
  25. })
  26. }