nitter/nitters/gitea/pr_nitter_test.go
Peter Kurfer 1707692170
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build is passing
test(gitea): add basic test for PR review creation
2023-03-09 08:46:13 +01:00

30 lines
781 B
Go

package gitea_test
import (
"errors"
"testing"
"github.com/golangci/golangci-lint/pkg/report"
"github.com/stretchr/testify/mock"
"code.icb4dc0.de/prskr/nitter/nitters/gitea"
"code.icb4dc0.de/prskr/nitter/nitters/gitea/mocks"
)
func Test_PRNitter_Report_MockCreatorError_Error(t *testing.T) {
expectedError := errors.New("error")
creator := mocks.NewPullReviewCreator(t)
creator.
EXPECT().
CreatePullReview(mock.Anything, mock.Anything, mock.Anything, mock.Anything).
Return(nil, nil, expectedError).
Times(1)
p := gitea.NewPRNitter(creator, &gitea.GiteaPRConfig{})
if err := p.Report(new(report.Data), nil); err == nil {
t.Error("expected error bot got none")
} else if !errors.Is(err, expectedError) {
t.Errorf("Error %v was not expected", err)
}
}