@@ -50,6 +50,7 @@ const GT_7D = '2018-11-23T17:50:44.477Z';
5050const LT_7D_GT_48H = '2018-11-27T17:50:44.477Z' ;
5151const LT_48H = '2018-11-30T17:50:44.477Z' ;
5252const LT_48H_GT_47H = '2018-11-29T17:55:44.477Z' ;
53+ const LT_48H_GT_47_59 = '2018-11-29T17:51:43.477Z' ;
5354const NOW = '2018-11-31T17:50:44.477Z' ;
5455
5556const argv = { maxCommits : 3 } ;
@@ -304,6 +305,43 @@ describe('PRChecker', () => {
304305 cli . assertCalledWith ( expectedLogs ) ;
305306 } ) ;
306307
308+ it ( 'should error when PR is younger than 48h and older than 47h58min' , ( ) => {
309+ const cli = new TestCLI ( ) ;
310+
311+ const expectedLogs = {
312+ ok :
313+ [ [ 'Approvals: 4' ] ,
314+ [ '- Foo User (@foo): https://github.com/nodejs/node/pull/16438#pullrequestreview-71480624' ] ,
315+ [ '- Quux User (@Quux): LGTM' ] ,
316+ [ '- Baz User (@Baz): https://github.com/nodejs/node/pull/16438#pullrequestreview-71488236' ] ,
317+ [ '- Bar User (@bar) (TSC): lgtm' ] ] ,
318+ info : [ [ 'This PR was created on Thu, 29 Nov 2018 17:51:43 GMT' ] ] ,
319+ error : [ [ 'This PR needs to wait 1 more minute to land' ] ]
320+ } ;
321+
322+ const youngPR = Object . assign ( { } , firstTimerPR , {
323+ createdAt : LT_48H_GT_47_59
324+ } ) ;
325+
326+ const data = {
327+ pr : youngPR ,
328+ reviewers : allGreenReviewers ,
329+ comments : commentsWithLGTM ,
330+ reviews : approvingReviews ,
331+ commits : simpleCommits ,
332+ collaborators,
333+ authorIsNew : ( ) => true ,
334+ getThread ( ) {
335+ return PRData . prototype . getThread . call ( this ) ;
336+ }
337+ } ;
338+ const checker = new PRChecker ( cli , data , { } , argv ) ;
339+
340+ const status = checker . checkReviewsAndWait ( new Date ( NOW ) ) ;
341+ assert ( ! status ) ;
342+ cli . assertCalledWith ( expectedLogs ) ;
343+ } ) ;
344+
307345 it ( 'should error when PR has only 1 approval < 48h' , ( ) => {
308346 const cli = new TestCLI ( ) ;
309347
@@ -350,7 +388,7 @@ describe('PRChecker', () => {
350388 info :
351389 [ [ 'This PR was created on Tue, 27 Nov 2018 17:50:44 GMT' ] ] ,
352390 error : [ [ 'This PR needs to wait 72 more hours to land ' +
353- '(or 0 hours if there is one more approval)' ] ]
391+ '(or 0 minutes if there is one more approval)' ] ]
354392 } ;
355393
356394 const youngPR = Object . assign ( { } , firstTimerPR , {
0 commit comments