@@ -68,23 +68,10 @@ describe('PullRequestGitHelper', function () {
6868 const pullRequest = new PullRequestModel ( credentialStore , telemetry , gitHubRepository , remote , prItem ) ;
6969
7070 // Setup: local branch exists with different commit than remote
71- const localBranch = {
72- type : RefType . Head ,
73- name : 'my-branch' ,
74- commit : 'local-commit-hash' ,
75- upstream : undefined ,
76- } ;
77- repository . state . refs . push ( localBranch ) ;
78- repository . _branches . push ( localBranch ) ;
71+ await repository . createBranch ( 'my-branch' , false , 'local-commit-hash' ) ;
7972
8073 // Setup: remote branch has different commit
81- const remoteBranch = {
82- type : RefType . RemoteHead ,
83- name : 'refs/remotes/origin/my-branch' ,
84- commit : 'remote-commit-hash' ,
85- } ;
86- repository . state . refs . push ( remoteBranch ) ;
87- repository . _branches . push ( remoteBranch ) ;
74+ await repository . createBranch ( 'refs/remotes/origin/my-branch' , false , 'remote-commit-hash' ) ;
8875
8976 const remotes = [ remote ] ;
9077
@@ -94,8 +81,8 @@ describe('PullRequestGitHelper', function () {
9481 await PullRequestGitHelper . fetchAndCheckout ( repository , remotes , pullRequest , { report : ( ) => undefined } ) ;
9582
9683 // Verify that the local branch was updated to point to the remote commit
97- const updatedBranch = repository . _branches . find ( b => b . name === 'my-branch' ) ;
98- assert . strictEqual ( updatedBranch ? .commit , 'remote-commit-hash' ) ;
84+ const updatedBranch = await repository . getBranch ( 'my-branch' ) ;
85+ assert . strictEqual ( updatedBranch . commit , 'remote-commit-hash' ) ;
9986 assert . strictEqual ( repository . state . HEAD ?. name , 'my-branch' ) ;
10087 } ) ;
10188 } ) ;
0 commit comments