-
-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failure for latitude #2080
Comments
Please also link to the failing pipeline for more information. |
expect(
latitude.toString().split('.')[1].length,
'The precision of latitude should be 4 digits'
).lessThanOrEqual(4); The problem is that this uses faker.number.float which occasionally (about every 10,000 test runs) will return say 2.0000 which is just returned as 2 for (let i = 0;i<100000;i++) {
const l = faker.location.latitude({ max: 5, min: -5 });
if (l.toString().split(".")[1]==undefined) {
console.log(l)
}
}
|
We could remove the default precision from the call, since it is a number anyway? |
I would fix the test not the method. Expect no decimal point or no more than 4 digits after the decimal point. |
I'm also for fixing the test, not the method implementation If we want to change the implementation, we should do this later and with a needs decision |
FAIL test/location.spec.ts > location > random seeded tests for seed 4743915782701865 > latitude() > returns latitude with min and max and default precision
The text was updated successfully, but these errors were encountered: