@@ -23,7 +23,7 @@ describe('Jenkins', () => {
23
23
const dummySHA = '51ce389dc1d539216d30bba0986a8c270801d65f' ;
24
24
25
25
before ( ( ) => {
26
- sinon . stub ( FormData . prototype , 'append' ) . callsFake ( function ( key , value ) {
26
+ const stubbed = sinon . stub ( FormData . prototype , 'append' ) . callsFake ( function ( key , value ) {
27
27
assert . strictEqual ( key , 'json' ) ;
28
28
const { parameter } = JSON . parse ( value ) ;
29
29
const expectedParameters = {
@@ -45,6 +45,8 @@ describe('Jenkins', () => {
45
45
46
46
return Reflect . apply ( FormData . prototype . append . wrappedMethod , this , arguments ) ;
47
47
} ) ;
48
+
49
+ return ( ) => stubbed . restore ( ) ;
48
50
} ) ;
49
51
50
52
it ( 'should fail if starting node-pull-request throws' , async ( ) => {
@@ -121,12 +123,17 @@ describe('Jenkins', () => {
121
123
before ( ( ) => {
122
124
sinon . replace ( PRData . prototype , 'getReviews' , function ( ) { } ) ;
123
125
sinon . replace ( PRData . prototype , 'getCommits' , function ( ) { } ) ;
126
+ return ( ) => {
127
+ PRData . prototype . getReviews . restore ( ) ;
128
+ PRData . prototype . getCommits . restore ( ) ;
129
+ } ;
124
130
} ) ;
125
131
afterEach ( ( ) => {
126
132
PRData . prototype . getCollaborators . restore ( ) ;
127
133
PRData . prototype . getComments . restore ( ) ;
128
134
PRChecker . prototype . getApprovedTipOfHead . restore ( ) ;
129
135
} ) ;
136
+
130
137
for ( const { headIsApproved = false , collaborators = [ ] , comments = [ ] , expected } of [ {
131
138
headIsApproved : true ,
132
139
expected : true ,
0 commit comments