@@ -8,15 +8,15 @@ const seededRuns = [
88 number : {
99 noArgs : 37454 ,
1010 numbers : [ 2 , 5 , 6 , 1 , 5 ] ,
11- withMin : 37427 ,
11+ withMin : 37412 ,
1212 withMinAndMax : - 1 ,
1313 withMax : 26 ,
1414 withMinAndMaxAndPrecision : - 0.43 ,
1515 } ,
1616 float : {
1717 noArgs : 37453.64 ,
1818 numbers : [ 37452 , 79656 , 95076 , 18342 , 73200 ] ,
19- withMin : 37427.37 ,
19+ withMin : 37411.64 ,
2020 withMinAndMax : - 0.43 ,
2121 withMax : 25.84 ,
2222 withMinAndMaxAndPrecision : - 0.4261 ,
@@ -80,15 +80,15 @@ const seededRuns = [
8080 number : {
8181 noArgs : 26202 ,
8282 numbers : [ 1 , 3 , 1 , 1 , 1 ] ,
83- withMin : 26171 ,
83+ withMin : 26160 ,
8484 withMinAndMax : - 13 ,
8585 withMax : 18 ,
8686 withMinAndMaxAndPrecision : - 12.92 ,
8787 } ,
8888 float : {
8989 noArgs : 26202.2 ,
9090 numbers : [ 26202 , 56052 , 15864 , 21258 , 27810 ] ,
91- withMin : 26171.21 ,
91+ withMin : 26160.2 ,
9292 withMinAndMax : - 12.92 ,
9393 withMax : 18.08 ,
9494 withMinAndMaxAndPrecision : - 12.9153 ,
@@ -152,15 +152,15 @@ const seededRuns = [
152152 number : {
153153 noArgs : 92852 ,
154154 numbers : [ 6 , 3 , 6 , 5 , 1 ] ,
155- withMin : 92849 ,
155+ withMin : 92810 ,
156156 withMinAndMax : 61 ,
157157 withMax : 64 ,
158158 withMinAndMaxAndPrecision : 61.07 ,
159159 } ,
160160 float : {
161161 noArgs : 92851.09 ,
162162 numbers : [ 92856 , 45900 , 89346 , 77826 , 22554 ] ,
163- withMin : 92848 .09,
163+ withMin : 92809 .09,
164164 withMinAndMax : 61.07 ,
165165 withMax : 64.07 ,
166166 withMinAndMaxAndPrecision : 61.0658 ,
@@ -288,6 +288,17 @@ describe('datatype', () => {
288288 } ) ;
289289 expect ( actual ) . toEqual ( expectations . number . withMinAndMaxAndPrecision ) ;
290290 } ) ;
291+
292+ it ( 'should throw when min > max' , ( ) => {
293+ const min = 10 ;
294+ const max = 9 ;
295+
296+ faker . seed ( seed ) ;
297+
298+ expect ( ( ) => {
299+ faker . datatype . number ( { min, max } ) ;
300+ } ) . toThrowError ( `Max ${ max } should be larger then min ${ min } ` ) ;
301+ } ) ;
291302 } ) ;
292303
293304 describe ( 'float' , ( ) => {
0 commit comments