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: Eval as boolean #619

Merged
merged 11 commits into from
Dec 1, 2020
Merged

Fix: Eval as boolean #619

merged 11 commits into from
Dec 1, 2020

Conversation

XVincentX
Copy link
Contributor

@XVincentX XVincentX commented Nov 30, 2020

The current code will fail and fallback to default options values in case the minItems or maxItems is 0, which is not what we want. (0 evaluates as false)

I have tried to write a test for it but apparently the helpers I found are not good enough. I do not know how to assert that the length of a schema-generated array is not empty, nor a way to say "it has at least X elements"

@XVincentX
Copy link
Contributor Author

@peterwald

@pateketrueke
Copy link
Member

I have tried to write a test for it but apparently the helpers I found are not good enough. I do not know how to assert that the length of a schema-generated array is not empty, nor a way to say "it has at least X elements"

Yeah, I think we could add a minLength around: https://github.com/json-schema-faker/json-schema-faker/blob/master/tests/schema/helpers.js#L94

pateketrueke
pateketrueke previously approved these changes Nov 30, 2020
@XVincentX
Copy link
Contributor Author

@pateketrueke

Tests added! If this is ready and could be releases, it'd be great 🙏

@codecov-io
Copy link

codecov-io commented Nov 30, 2020

Codecov Report

Merging #619 (0cc08a1) into master (2e5c9f3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #619   +/-   ##
=======================================
  Coverage   55.35%   55.35%           
=======================================
  Files          27       27           
  Lines         775      775           
=======================================
  Hits          429      429           
  Misses        346      346           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e5c9f3...0cc08a1. Read the comment docs.

@XVincentX
Copy link
Contributor Author

@pateketrueke Is this going to be merged/released automatically? What's the procedure?

@pateketrueke
Copy link
Member

I was waiting for TravisCI to complete, thank you!

@pateketrueke pateketrueke merged commit 50eb15f into json-schema-faker:master Dec 1, 2020
@XVincentX XVincentX deleted the fix/bool-eval branch December 1, 2020 00:12
@XVincentX
Copy link
Contributor Author

Ay perfecto!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants