Open emilyanndavis opened 7 years ago
@BlakeGuilloud I would like to work on this
@emilyanndavis What are you testing for with this assertion?
expect(() => randomInRange(1.0, 10)).toThrow()
javaScript doesn't differentiate between floats and ints, so for all intents and purposes 1.0 === 1
Or is there something that I'm missing here?
Oops. You're absolutely right @jmknoll ! That test was supposed to make sure the first param is an integer but, as you've pointed out, JavaScript doesn't care whether it's 1 or 1.00000. Feel free to change that 1.0 to something that won't be evaluated as equivalent to an integer. Good catch!
All good. I had already commented out the test by the time I submitted the PR implementing this function, but I think the other parameter tests are sufficient enough to cover for this one.
There is currently a method called
randomInRange
that lives in/lib/randomInRange.js
. It is incomplete and needs to be fixed!randomInRange
returns a random integer that falls within a given range, inclusive of themin
andmax
integers provided. For example,randomInRange(10, 15)
could return 10, 11, 12, 13, 14, or 15.Acceptance Criteria:
yarn test randomInRange
results in tests passing.yarn lint
does not print any errors to the console!Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.
Thank you so much for your contribution!