Skip to content

Remove use of deprecated test.InitCmdStubber#2828

Merged
mislav merged 5 commits intocli:trunkfrom
dpromanko:dpromanko/remove-init-cmd-stubber
Jan 25, 2021
Merged

Remove use of deprecated test.InitCmdStubber#2828
mislav merged 5 commits intocli:trunkfrom
dpromanko:dpromanko/remove-init-cmd-stubber

Conversation

@dpromanko
Copy link
Contributor

Follow up to #2801 to cleanup the TODOs around deprecating test.InitCmdStubber.

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Thank you for the hard work!

Note that you have inadvertently changed some stubs, causing the change in the test logic. I have reverted those stub values to their original.

Comment on lines -884 to -886
cs.Stub(`deadbeef HEAD
deadb00f refs/remotes/origin/feature
deadbeef refs/remotes/upstream/feature`) // git show-ref --verify (ShowRefs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contents of this stub was unnecessarily changed in the rewrite. I will revert it to its original value

Comment on lines -911 to -912
cs.Stub(`branch.feature.remote origin
branch.feature.merge refs/heads/great-feat`) // git config --get-regexp (ReadBranchConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contents of this stub was replaced with an empty string in the rewrite. I will make a change to bring back the original value

t.Errorf("expected nil result, got %v", ref)
}

assert.Equal(t, []string{"git", "show-ref", "--verify", "--", "HEAD", "refs/remotes/origin/great-feat", "refs/remotes/origin/feature"}, cs.Calls[1].Args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expectation was replaced with the pattern git show-ref --verify -- HEAD refs/remotes/origin/feature, which is incomplete since it does not include great-feat in the match.

@dpromanko
Copy link
Contributor Author

@mislav thanks for fixing up those few stubs that I changed. I was struggling with the formatting of the output not matching without adding the newlines. Now I see you can use heredoc in that case. Also thanks for stubbing out the browser calls. I couldn't figure that piece out either 😄

@mislav
Copy link
Contributor

mislav commented Jan 25, 2021

@dpromanko No worries. These tests are messy and hard to edit, as evident by me rather leaving TODO comments than refactoring them myself 😅😅

@mislav mislav merged commit d0a4639 into cli:trunk Jan 25, 2021
@dpromanko dpromanko deleted the dpromanko/remove-init-cmd-stubber branch January 26, 2021 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants