Skip to content
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

fix: deterministic results for address.nearbyGPSCoordinate #737

Merged
merged 8 commits into from
Apr 1, 2022
Merged

fix: deterministic results for address.nearbyGPSCoordinate #737

merged 8 commits into from
Apr 1, 2022

Conversation

xDivisionByZerox
Copy link
Member

closes #736

@xDivisionByZerox xDivisionByZerox added c: bug Something isn't working p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug labels Mar 30, 2022
@xDivisionByZerox xDivisionByZerox requested a review from a team March 30, 2022 18:17
@xDivisionByZerox xDivisionByZerox self-assigned this Mar 30, 2022
@xDivisionByZerox xDivisionByZerox requested a review from a team as a code owner March 30, 2022 18:17
@codecov
Copy link

codecov bot commented Mar 30, 2022

Codecov Report

Merging #737 (d7a9317) into main (c3be3b1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head d7a9317 differs from pull request most recent head cbf2384. Consider uploading reports for the commit cbf2384 to get more accurate results

@@           Coverage Diff           @@
##             main     #737   +/-   ##
=======================================
  Coverage   99.34%   99.34%           
=======================================
  Files        1925     1925           
  Lines      177024   177030    +6     
  Branches      909      909           
=======================================
+ Hits       175871   175877    +6     
  Misses       1097     1097           
  Partials       56       56           
Impacted Files Coverage Δ
src/address.ts 99.11% <100.00%> (+<0.01%) ⬆️

pkuczynski
pkuczynski previously approved these changes Mar 30, 2022
src/address.ts Outdated Show resolved Hide resolved
test/address.spec.ts Outdated Show resolved Hide resolved
test/address.spec.ts Outdated Show resolved Hide resolved
@ST-DDT ST-DDT requested a review from a team March 30, 2022 21:01
src/address.ts Outdated Show resolved Hide resolved
@Shinigami92
Copy link
Member

@xDivisionByZerox Tests need update (?)

@xDivisionByZerox
Copy link
Member Author

I'm testing local again to see if I forgot something, but I normally always run tests locally before pushing :/

@xDivisionByZerox
Copy link
Member Author

xDivisionByZerox commented Mar 31, 2022

The max: 360 property in datatype.number implemented a rounding change on the 4th decimal place of 1 expect value :)

@xDivisionByZerox
Copy link
Member Author

The max: 360 property in datatype.number implemented a rounding change on the 4th decimal place of 1 expect value :)

Well, that's funny;
If I set up a test by myself I get [ '-0.0394', '0.0396' ] as result.

import { faker } from './src';

faker.seed(42);
console.log(faker.address.nearbyGPSCoordinate([0, 0]));

But if I run the test suite it gets [ '-0.0393', '0.0396' ]

@Shinigami92
Copy link
Member

Should we use 1e-5 ?

@ST-DDT
Copy link
Member

ST-DDT commented Mar 31, 2022

I think 0.01 is enough.

EDIT: Let me do some quick math.

@xDivisionByZerox
Copy link
Member Author

I think 0.01 is enough.

I'll just do that. With 4 decimal points, it just works sometimes and sometimes it doesn't.

@xDivisionByZerox
Copy link
Member Author

Let's see if this works one last time before I update the precision.

@xDivisionByZerox
Copy link
Member Author

🎉🎉🎉

@ST-DDT ST-DDT requested review from Shinigami92 and a team March 31, 2022 20:39
@Shinigami92 Shinigami92 changed the title fix(address.nearbyGPSCoordinate): deterministic results fix: deterministic results for address.nearbyGPSCoordinate Apr 1, 2022
@Shinigami92 Shinigami92 enabled auto-merge (squash) April 1, 2022 14:08
@Shinigami92 Shinigami92 merged commit bc7bd57 into faker-js:main Apr 1, 2022
@xDivisionByZerox xDivisionByZerox deleted the 736-address-nearbygpscoordinate-non-deterministic-results branch April 15, 2022 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

address.nearbyGPSCoordinate non deterministic results
5 participants