faker
faker copied to clipboard
feat(number): add romanNumeral method
This is a draft, please check this
Deploy Preview for fakerjs ready!
| Name | Link |
|---|---|
| Latest commit | 6e04bef8b03b370c1bcb67489fd3b029bd745722 |
| Latest deploy log | https://app.netlify.com/sites/fakerjs/deploys/6723548764693d0008135ec3 |
| Deploy Preview | https://deploy-preview-3070.fakerjs.dev |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
In this commit 7abd2c7b262a31d5a699a17f99dcfab9d4650afd i created a new function intToRomanNumeral so where should i place it ?
How should i write random seeded test for "it('should generate a Roman numeral between 1 and 10')" ? Since i don't what answer will be.
And there will be no value range test ?
There's a few ways you could do it. For 1 to 10 you could check if it's any of the values from I to X by listing all 10 values.
You could also check it only contains suitable characters.
Also add tests that check hitting each of the errors and check appropriate error is thrown.
Please let me know if there are any changes with the code and test if not i will run preflight and then commit the code
Ideally please run preflight after every change. This will help catch any minor syntax errors etc so the reviewers can focus on the logic of your code rather than nitpicking.
I ran into an error during preflight FakerApiDocsProcessingError: Failed to process parameter options at src/modules/number/index.ts:468:16 : Expected exactly one element for jsdocs, got 0
Expected exactly one element for jsdocs
its not a very intuitive error message but i think the problem is that you're missing a @since JSDoc tag
add
@since 9.1.0 at the bottom of the JSDoc as this likely wont be in the 9.0.0 release.
I ran into an error during preflight
FakerApiDocsProcessingError: Failed to process parameter options at src/modules/number/index.ts:468:16 : Expected exactly one element for jsdocs, got 0
The error is not caused by @since. It is caused by the options.min/max parameter not having jsdocs.
I'll improve the error message.
FakerApiDocsProcessingError: Failed to process property 'options.min' at src/modules/number/index.ts:467:36 : Expected exactly one element for jsdocs, got 0
The options object should be defined like this:
romanNumeral(
options:
| number
| {
/**
* Lower bound for generated number.
*
* @default 1
*/
min?: number;
/**
* Upper bound for generated number.
*
* @default 3999
*/
max?: number;
} = {}
): string {
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.96%. Comparing base (
c02beea) to head (6e04bef). Report is 1 commits behind head on next.
Additional details and impacted files
@@ Coverage Diff @@
## next #3070 +/- ##
=======================================
Coverage 99.95% 99.96%
=======================================
Files 2805 2805
Lines 217025 217070 +45
Branches 956 969 +13
=======================================
+ Hits 216938 217002 +64
+ Misses 87 68 -19
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| src/modules/number/index.ts | 100.00% <100.00%> (ΓΈ) |
@AmaanRS Could you please address the requested changes?
Please also change the description of the PR to something explaining the feature in more detail. A few sentences are sufficient.
@Shinigami92 and @import-brain Could you please re-review this PR (or dismiss your stale reviews)?
@AmaanRS Thanks for your first contribution. β€οΈ I hope you had a good experience contributing. If you have any suggestions on how to improve things, please let us know.
This feature will be released in Faker v9.2, which will probably release shortly (a week to a few weeks).