@@ -436,6 +436,53 @@ describe('phase helper unit tests', () => {
436436 updatedPhases [ 0 ] . duration . should . equal ( duration )
437437 } )
438438
439+ it ( 'allows started non-Design phase schedule to move earlier when duration is unchanged' , async ( ) => {
440+ const registrationPhaseId = 'development-registration-phase'
441+ const currentRegistrationStartDate = '2099-05-26T05:14:00.000Z'
442+ const currentRegistrationEndDate = '2099-05-31T05:14:00.000Z'
443+ const requestedRegistrationStartDate = '2099-05-25T05:14:00.000Z'
444+ const requestedRegistrationEndDate = '2099-05-30T05:14:00.000Z'
445+ const duration = 5 * 24 * 60 * 60
446+
447+ stubPhaseLookups (
448+ [ { id : registrationPhaseId , name : 'Registration' , description : 'Registration phase' } ] ,
449+ [ { phaseId : registrationPhaseId , defaultDuration : duration } ]
450+ )
451+
452+ const updatedPhases = await phaseHelper . populatePhasesForChallengeUpdate (
453+ [
454+ {
455+ duration,
456+ isOpen : true ,
457+ name : 'Registration' ,
458+ phaseId : registrationPhaseId ,
459+ actualStartDate : requestedRegistrationStartDate ,
460+ scheduledStartDate : currentRegistrationStartDate ,
461+ scheduledEndDate : currentRegistrationEndDate
462+ }
463+ ] ,
464+ [
465+ {
466+ duration,
467+ phaseId : registrationPhaseId ,
468+ scheduledStartDate : requestedRegistrationStartDate ,
469+ scheduledEndDate : requestedRegistrationEndDate
470+ }
471+ ] ,
472+ 'timeline-template-id' ,
473+ false ,
474+ {
475+ allowActivePhaseShortening : false ,
476+ preventPhaseShortening : true
477+ }
478+ )
479+
480+ updatedPhases [ 0 ] . actualStartDate . should . equal ( requestedRegistrationStartDate )
481+ updatedPhases [ 0 ] . scheduledStartDate . should . equal ( requestedRegistrationStartDate )
482+ updatedPhases [ 0 ] . scheduledEndDate . should . equal ( requestedRegistrationEndDate )
483+ updatedPhases [ 0 ] . duration . should . equal ( duration )
484+ } )
485+
439486 it ( 'allows active non-Design dependent phases to move earlier when duration is unchanged' , async ( ) => {
440487 const registrationPhaseId = 'development-registration-phase'
441488 const reviewPhaseId = 'development-review-phase'
0 commit comments