This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
test/GitHub.App.UnitTests/Services Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -777,6 +777,35 @@ public async Task ShouldCheckoutLocalBranchAsync()
777777 Assert . That ( 4 , Is . EqualTo ( gitClient . ReceivedCalls ( ) . Count ( ) ) ) ;
778778 }
779779
780+ [ Test ]
781+ public async Task ShouldCheckoutLocalBranchOwnerCaseMismatchAsync ( )
782+ {
783+ var gitClient = MockGitClient ( ) ;
784+ var service = CreateTarget ( gitClient , MockGitService ( ) ) ;
785+
786+ var localRepo = Substitute . For < ILocalRepositoryModel > ( ) ;
787+ localRepo . CloneUrl . Returns ( new UriString ( "https://foo.bar/Owner/repo" ) ) ;
788+
789+ var pr = new PullRequestDetailModel
790+ {
791+ Number = 5 ,
792+ BaseRefName = "master" ,
793+ BaseRefSha = "123" ,
794+ BaseRepositoryOwner = "owner" ,
795+ HeadRefName = "prbranch" ,
796+ HeadRefSha = "123" ,
797+ HeadRepositoryOwner = "owner" ,
798+ } ;
799+
800+ await service . Checkout ( localRepo , pr , "prbranch" ) ;
801+
802+ gitClient . Received ( ) . Fetch ( Arg . Any < IRepository > ( ) , "origin" ) . Forget ( ) ;
803+ gitClient . Received ( ) . Checkout ( Arg . Any < IRepository > ( ) , "prbranch" ) . Forget ( ) ;
804+ gitClient . Received ( ) . SetConfig ( Arg . Any < IRepository > ( ) , "branch.prbranch.ghfvs-pr-owner-number" , "owner#5" ) . Forget ( ) ;
805+
806+ Assert . That ( 4 , Is . EqualTo ( gitClient . ReceivedCalls ( ) . Count ( ) ) ) ;
807+ }
808+
780809 [ Test ]
781810 public async Task ShouldCheckoutBranchFromForkAsync ( )
782811 {
You can’t perform that action at this time.
0 commit comments