faker icon indicating copy to clipboard operation
faker copied to clipboard

test: properly convert function name to locale entry name

Open ST-DDT opened this issue 1 year ago • 5 comments

Currently, the animal tests use the function name as the name of the entry. This however doesn't work when the name uses camelCase such as petName.

This PR changes the locale data lookup to convert the camelCase function name to a snake_case locale entry name before using it.

Required for

  • #3196

ST-DDT avatar Oct 19 '24 12:10 ST-DDT

Deploy Preview for fakerjs ready!

Name Link
Latest commit c11488e0d012a01fc65eb2d190d2420e1b1103ae
Latest deploy log https://app.netlify.com/sites/fakerjs/deploys/67196b75dee08100086ad6a8
Deploy Preview https://deploy-preview-3197.fakerjs.dev
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Oct 19 '24 12:10 netlify[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.95%. Comparing base (e3858f2) to head (c11488e). Report is 3 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3197      +/-   ##
==========================================
- Coverage   99.96%   99.95%   -0.01%     
==========================================
  Files        2797     2797              
  Lines      216762   216762              
  Branches      579      581       +2     
==========================================
- Hits       216686   216675      -11     
- Misses         76       87      +11     

see 1 file with indirect coverage changes

codecov[bot] avatar Oct 19 '24 12:10 codecov[bot]

Would it be better just to explicitly test each method in turn? Its repetitive but maybe easier to understand. Most other simple modules, even ones which are just helpers.arrayElement wrappers like faker.book just test every method one by one.

matthewmayer avatar Oct 19 '24 12:10 matthewmayer

Would it be better just to explicitly test each method in turn? Its repetitive but maybe easier to understand. Most other simple modules, even ones which are just helpers.arrayElement wrappers like faker.book just test every method one by one.

for comparison i made #3198 - i find this easier to read and more consistent with other modules.

matthewmayer avatar Oct 19 '24 13:10 matthewmayer

for comparison i made #3198 - i find this easier to read and more consistent with other modules.

Thanks for creating the PR for comparison. IMO the current loop based version is easier/faster to fully understand, but I don't have a strong opinion either way.

ST-DDT avatar Oct 19 '24 18:10 ST-DDT