testutil

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertActivityEquals

func AssertActivityEquals(t *testing.T, expected, actual *pullrequest.Activity)

AssertActivityEquals verifies two activities are equal

func AssertAllDrafts

func AssertAllDrafts(t *testing.T, prs []*pullrequest.PullRequest)

AssertAllDrafts verifies all PRs in a slice are drafts

func AssertContainsPR

func AssertContainsPR(t *testing.T, slice []*pullrequest.PullRequest, pr *pullrequest.PullRequest)

AssertContainsPR verifies a PR slice contains a specific PR

func AssertNoDrafts

func AssertNoDrafts(t *testing.T, prs []*pullrequest.PullRequest)

AssertNoDrafts verifies no PRs in a slice are drafts

func AssertNotContainsPR

func AssertNotContainsPR(t *testing.T, slice []*pullrequest.PullRequest, pr *pullrequest.PullRequest)

AssertNotContainsPR verifies a PR slice does not contain a specific PR

func AssertPREquals

func AssertPREquals(t *testing.T, expected, actual *pullrequest.PullRequest)

AssertPREquals verifies two PRs are equal

func AssertPRSlicesEqual

func AssertPRSlicesEqual(t *testing.T, expected, actual []*pullrequest.PullRequest)

AssertPRSlicesEqual verifies two PR slices contain the same PRs

func CreateTestPRs

func CreateTestPRs(regularCount, draftCount int) []*pullrequest.PullRequest

CreateTestPRs creates multiple test PRs with specified draft counts

func CreateTestPRsWithActivities

func CreateTestPRsWithActivities(count int, activitiesPerPR int, activityAge time.Duration) []*pullrequest.PullRequest

CreateTestPRsWithActivities creates test PRs with activities

func NewTestActivity

func NewTestActivity(activityType pullrequest.ActivityType, createdAt time.Time, opts ...func(*testActivityBuilder)) *pullrequest.Activity

NewTestActivity creates a test activity

func NewTestAuthor

func NewTestAuthor(login string) pullrequest.Author

NewTestAuthor creates a test author

func NewTestPullRequest

func NewTestPullRequest(number int, opts ...func(*testPRBuilder)) *pullrequest.PullRequest

NewTestPullRequest creates a test pull request with sensible defaults

func NewTestRepository

func NewTestRepository(nameWithOwner string) pullrequest.RepositoryInfo

NewTestRepository creates a test repository

func NewTestReview

func NewTestReview(state pullrequest.ReviewState, submittedAt time.Time) *pullrequest.Review

func WithActivityAuthor

func WithActivityAuthor(login string) func(*testActivityBuilder)

WithActivityAuthor sets the activity author

func WithActivityBody

func WithActivityBody(body string) func(*testActivityBuilder)

WithActivityBody sets the activity body

func WithActivityPR

func WithActivityPR(url string, number int) func(*testActivityBuilder)

WithActivityPR sets the PR identifier for the activity

func WithAuthor

func WithAuthor(login string) func(*testPRBuilder)

WithAuthor sets the PR author

func WithCreatedAt

func WithCreatedAt(t time.Time) func(*testPRBuilder)

WithCreatedAt sets the PR creation time

func WithDraft

func WithDraft(isDraft bool) func(*testPRBuilder)

WithDraft sets the PR draft status

func WithRepository

func WithRepository(nameWithOwner string) func(*testPRBuilder)

WithRepository sets the PR repository

func WithTitle

func WithTitle(title string) func(*testPRBuilder)

WithTitle sets the PR title

func WithURL

func WithURL(url string) func(*testPRBuilder)

WithURL sets the PR URL

Types

type PROption

type PROption func(*pullrequest.PullRequest)

PROption allows functional options pattern for test PR creation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL