Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions pkg/cmd/pr/checkout/checkout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func TestPRCheckout_sameRepo(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
finder := shared.RunCommandFinder("123", pr, baseRepo)
finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})

cs, cmdTeardown := run.Stub()
Expand All @@ -539,7 +539,7 @@ func TestPRCheckout_existingBranch(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand Down Expand Up @@ -570,7 +570,7 @@ func TestPRCheckout_differentRepo_remoteExists(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:feature")
finder := shared.RunCommandFinder("123", pr, baseRepo)
finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})

cs, cmdTeardown := run.Stub()
Expand All @@ -590,7 +590,7 @@ func TestPRCheckout_differentRepo(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
finder := shared.RunCommandFinder("123", pr, baseRepo)
finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})

cs, cmdTeardown := run.Stub()
Expand All @@ -613,7 +613,7 @@ func TestPRCheckout_differentRepoForce(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
finder := shared.RunCommandFinder("123", pr, baseRepo)
finder := shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)
finder.ExpectFields([]string{"number", "headRefName", "headRepository", "headRepositoryOwner", "isCrossRepository", "maintainerCanModify"})

cs, cmdTeardown := run.Stub()
Expand All @@ -636,7 +636,7 @@ func TestPRCheckout_differentRepo_existingBranch(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -655,7 +655,7 @@ func TestPRCheckout_detachedHead(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -674,7 +674,7 @@ func TestPRCheckout_differentRepo_currentBranch(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -693,7 +693,7 @@ func TestPRCheckout_differentRepo_invalidBranchName(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:-foo")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

_, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -711,7 +711,7 @@ func TestPRCheckout_maintainerCanModify(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
pr.MaintainerCanModify = true
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -732,7 +732,7 @@ func TestPRCheckout_recurseSubmodules(t *testing.T) {
http := &httpmock.Registry{}

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -753,7 +753,7 @@ func TestPRCheckout_force(t *testing.T) {
http := &httpmock.Registry{}

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand All @@ -774,7 +774,7 @@ func TestPRCheckout_detach(t *testing.T) {
defer http.Verify(t)

baseRepo, pr := stubPR("OWNER/REPO:master", "hubot/REPO:feature")
shared.RunCommandFinder("123", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "123", pr, baseRepo)

cs, cmdTeardown := run.Stub()
defer cmdTeardown(t)
Expand Down
14 changes: 7 additions & 7 deletions pkg/cmd/pr/close/close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestPrClose(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

http.Register(
httpmock.GraphQL(`mutation PullRequestClose\b`),
Expand All @@ -133,7 +133,7 @@ func TestPrClose_alreadyClosed(t *testing.T) {
baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
pr.State = "CLOSED"
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

output, err := runCommand(http, true, "96")
assert.NoError(t, err)
Expand All @@ -147,7 +147,7 @@ func TestPrClose_deleteBranch_sameRepo(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:blueberries")
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

http.Register(
httpmock.GraphQL(`mutation PullRequestClose\b`),
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestPrClose_deleteBranch_crossRepo(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO", "hubot/REPO:blueberries")
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

http.Register(
httpmock.GraphQL(`mutation PullRequestClose\b`),
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestPrClose_deleteBranch_sameBranch(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO:main", "OWNER/REPO:trunk")
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

http.Register(
httpmock.GraphQL(`mutation PullRequestClose\b`),
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestPrClose_deleteBranch_notInGitRepo(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO:main", "OWNER/REPO:trunk")
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

http.Register(
httpmock.GraphQL(`mutation PullRequestClose\b`),
Expand Down Expand Up @@ -282,7 +282,7 @@ func TestPrClose_withComment(t *testing.T) {

baseRepo, pr := stubPR("OWNER/REPO", "OWNER/REPO:feature")
pr.Title = "The title of the PR"
shared.RunCommandFinder("96", pr, baseRepo)
shared.StubFinderForRunCommandStyleTests(t, "96", pr, baseRepo)

http.Register(
httpmock.GraphQL(`mutation CommentCreate\b`),
Expand Down
Loading
Loading