@@ -34,6 +34,7 @@ test.serial(
3434 const actualRef = await gitUtils . getRef ( ) ;
3535 t . deepEqual ( actualRef , expectedRef ) ;
3636
37+ t . is ( callback . callCount , 1 ) ;
3738 t . true ( callback . calledOnceWith ( tmpDir , "HEAD" ) ) ;
3839 } ) ;
3940 } ,
@@ -58,6 +59,8 @@ test.serial(
5859 const actualRef = await gitUtils . getRef ( ) ;
5960 t . deepEqual ( actualRef , expectedRef ) ;
6061
62+ t . is ( callback . callCount , 2 ) ;
63+ t . true ( callback . calledWith ( tmpDir , "HEAD" ) ) ;
6164 t . true ( callback . calledWith ( tmpDir , "refs/remotes/pull/1/merge" ) ) ;
6265 } ) ;
6366 } ,
@@ -72,14 +75,18 @@ test.serial(
7275 process . env [ "GITHUB_SHA" ] = "a" . repeat ( 40 ) ;
7376
7477 const callback = sinon . stub ( gitUtils , "getCommitOid" ) ;
75- callback . withArgs ( tmpDir , "refs/pull/1/merge" ) . resolves ( "a" . repeat ( 40 ) ) ;
78+ callback
79+ . withArgs ( tmpDir , "refs/remotes/pull/1/merge" )
80+ . resolves ( "a" . repeat ( 40 ) ) ;
7681 callback . withArgs ( tmpDir , "HEAD" ) . resolves ( "b" . repeat ( 40 ) ) ;
82+ callback . throws ( new Error ( "Unexpected getCommitOid call in test." ) ) ;
7783
7884 const actualRef = await gitUtils . getRef ( ) ;
7985 t . deepEqual ( actualRef , "refs/pull/1/head" ) ;
8086
81- t . true ( callback . calledOnceWith ( tmpDir , "refs/pull/1/merge" ) ) ;
82- t . true ( callback . calledOnceWith ( tmpDir , "HEAD" ) ) ;
87+ t . is ( callback . callCount , 2 ) ;
88+ t . true ( callback . calledWith ( tmpDir , "refs/remotes/pull/1/merge" ) ) ;
89+ t . true ( callback . calledWith ( tmpDir , "HEAD" ) ) ;
8390 } ) ;
8491 } ,
8592) ;
@@ -107,8 +114,8 @@ test.serial(
107114 const actualRef = await gitUtils . getRef ( ) ;
108115 t . deepEqual ( actualRef , "refs/pull/2/merge" ) ;
109116
110- t . true ( callback . calledOnceWith ( tmpDir , "refs/pull/1/merge" ) ) ;
111- t . true ( callback . calledOnceWith ( tmpDir , "HEAD" ) ) ;
117+ // getCommitOid shouldn't be called, because the ref should be taken from the input
118+ t . is ( callback . callCount , 0 ) ;
112119 } ) ;
113120 } ,
114121) ;
0 commit comments