File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -941,6 +941,20 @@ describe('getActiveProductTrial', () => {
941941 expect ( replay_pt ) . toBeNull ( ) ;
942942 } ) ;
943943
944+ it ( 'returns null when trial is isStarted but startDate is in the future' , ( ) => {
945+ const trials : ProductTrial [ ] = [
946+ {
947+ category : DataCategory . SPANS ,
948+ isStarted : true ,
949+ reasonCode : 4001 ,
950+ startDate : moment ( ) . utc ( ) . add ( 5 , 'days' ) . format ( ) ,
951+ endDate : moment ( ) . utc ( ) . add ( 35 , 'days' ) . format ( ) ,
952+ } ,
953+ ] ;
954+ const pt = getActiveProductTrial ( trials , DataCategory . SPANS ) ;
955+ expect ( pt ) . toBeNull ( ) ;
956+ } ) ;
957+
944958 it ( 'returns null trial when no trials for category' , ( ) => {
945959 const pt = getProductTrial ( TEST_TRIALS , DataCategory . ATTACHMENTS ) ;
946960 expect ( pt ) . toBeNull ( ) ;
Original file line number Diff line number Diff line change @@ -693,7 +693,8 @@ export function getActiveProductTrial(
693693 pt =>
694694 pt . category === category &&
695695 pt . isStarted &&
696- getDaysSinceDate ( pt . endDate ?? '' ) <= 0
696+ getDaysSinceDate ( pt . endDate ?? '' ) <= 0 &&
697+ getDaysSinceDate ( pt . startDate ?? '' ) >= 0
697698 )
698699 . sort ( ( a , b ) => b . endDate ?. localeCompare ( a . endDate ?? '' ) || 0 ) ;
699700
You can’t perform that action at this time.
0 commit comments