Commit 8d03062 1 parent 83e9101 commit 8d03062 Copy full SHA for 8d03062
File tree 1 file changed +13
-2
lines changed
test-db-manager/src/builders
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,19 @@ import { randomInt } from '../utils';
6
6
export const buildLabelArray = ( labelPrefix : string , labelCount : number ) =>
7
7
range ( 1 , labelCount + 1 ) . map ( ( no ) => `${ labelPrefix } ${ no } ` ) ;
8
8
9
- export const buildRandomDuration = ( min : Duration , max : Duration ) =>
10
- Duration . fromMillis ( randomInt ( min . toMillis ( ) , max . toMillis ( ) ) ) ;
9
+ export const buildRandomDuration = ( min : Duration , max : Duration ) => {
10
+ const unroundedDuration = Duration . fromMillis (
11
+ randomInt ( min . toMillis ( ) , max . toMillis ( ) ) ,
12
+ ) ;
13
+
14
+ // We only want to handle durations in minute precision, currently.
15
+ const durationParts = unroundedDuration . rescale ( ) . toObject ( ) ;
16
+ delete durationParts . seconds ;
17
+ delete durationParts . milliseconds ;
18
+ const durationInMinutes = Duration . fromObject ( durationParts ) ;
19
+
20
+ return durationInMinutes ;
21
+ } ;
11
22
12
23
type ConstantCount = number ;
13
24
type RandomCount = { min : number ; max : number } ;
You can’t perform that action at this time.
0 commit comments