@@ -19,7 +19,7 @@ describe('number', () => {
1919 } ) ;
2020
2121 t . describe ( 'float' , ( t ) => {
22- t . it ( 'with plain number' , 0.000001 )
22+ t . it ( 'with plain number' , 4 )
2323 . it ( 'with min' , { min : - 42 } )
2424 . it ( 'with max' , { max : 69 } )
2525 . it ( 'with min and max' , { min : - 42 , max : 69 } )
@@ -143,36 +143,37 @@ describe('number', () => {
143143
144144 describe ( 'float' , ( ) => {
145145 it ( 'should return a random float with a default precision of 2 digits after floating point' , ( ) => {
146- const number = faker . number . float ( ) ;
147- expect ( number ) . toBe ( Number ( number . toFixed ( 2 ) ) ) ;
146+ const actual = faker . number . float ( ) ;
147+ expect ( actual ) . toBe ( Number ( actual . toFixed ( 2 ) ) ) ;
148148 } ) ;
149149
150- it ( 'should return a random float given a precision value' , ( ) => {
151- const number = faker . number . float ( 0.001 ) ;
152- expect ( number ) . toBe ( Number ( number . toFixed ( 3 ) ) ) ;
150+ it ( 'should return a random float with given max' , ( ) => {
151+ const actual = faker . number . float ( 3 ) ;
152+ expect ( actual ) . toBeGreaterThanOrEqual ( 0 ) ;
153+ expect ( actual ) . toBeLessThanOrEqual ( 3 ) ;
153154 } ) ;
154155
155156 it ( 'should return a random number given a max value of 10' , ( ) => {
156- const float = faker . number . float ( { max : 10 } ) ;
157- expect ( float ) . toBeGreaterThanOrEqual ( 0 ) ;
158- expect ( float ) . toBeLessThanOrEqual ( 10 ) ;
157+ const actual = faker . number . float ( { max : 10 } ) ;
158+ expect ( actual ) . toBeGreaterThanOrEqual ( 0 ) ;
159+ expect ( actual ) . toBeLessThanOrEqual ( 10 ) ;
159160 } ) ;
160161
161162 it ( 'should return 0 given a max value of 0' , ( ) => {
162163 expect ( faker . number . float ( { max : 0 } ) ) . toBe ( 0 ) ;
163164 } ) ;
164165
165166 it ( 'should return a random number given a negative number min and max value of 0' , ( ) => {
166- const float = faker . number . float ( { min : - 100 , max : 0 } ) ;
167- expect ( float ) . toBeGreaterThanOrEqual ( - 100 ) ;
168- expect ( float ) . toBeLessThanOrEqual ( 0 ) ;
167+ const actual = faker . number . float ( { min : - 100 , max : 0 } ) ;
168+ expect ( actual ) . toBeGreaterThanOrEqual ( - 100 ) ;
169+ expect ( actual ) . toBeLessThanOrEqual ( 0 ) ;
169170 } ) ;
170171
171172 it ( 'should return a random number between a range' , ( ) => {
172173 for ( let i = 0 ; i < 5 ; i ++ ) {
173- const randomNumber = faker . number . float ( { min : 22 , max : 33 } ) ;
174- expect ( randomNumber ) . toBeGreaterThanOrEqual ( 22 ) ;
175- expect ( randomNumber ) . toBeLessThanOrEqual ( 33 ) ;
174+ const actual = faker . number . float ( { min : 22 , max : 33 } ) ;
175+ expect ( actual ) . toBeGreaterThanOrEqual ( 22 ) ;
176+ expect ( actual ) . toBeLessThanOrEqual ( 33 ) ;
176177 }
177178 } ) ;
178179
@@ -211,19 +212,19 @@ describe('number', () => {
211212
212213 it ( 'provides numbers with an exact precision' , ( ) => {
213214 for ( let i = 0 ; i < 100 ; i ++ ) {
214- const number = faker . number . float ( {
215+ const actual = faker . number . float ( {
215216 min : 0.5 ,
216217 max : 0.99 ,
217218 precision : 0.01 ,
218219 } ) ;
219- expect ( number ) . toBe ( Number ( number . toFixed ( 2 ) ) ) ;
220+ expect ( actual ) . toBe ( Number ( actual . toFixed ( 2 ) ) ) ;
220221 }
221222 } ) ;
222223
223224 it ( 'provides number with a precision 0' , ( ) => {
224- const float = faker . number . float ( { precision : 0 } ) ;
225+ const actual = faker . number . float ( { precision : 0 } ) ;
225226
226- expect ( float ) . toBe ( Math . floor ( float ) ) ;
227+ expect ( actual ) . toBe ( Math . floor ( actual ) ) ;
227228 } ) ;
228229
229230 it ( 'should not modify the input object' , ( ) => {
0 commit comments