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

Add more tests for util functions #577

Merged
merged 9 commits into from May 1, 2020
Merged

Add more tests for util functions #577

merged 9 commits into from May 1, 2020

Conversation

rachidlamouri
Copy link
Contributor

  • Installed cross-env since I develop on windows, otherwise setting env vars in the npm scripts doesn't work
  • Added a lint config for the tests
  • I think some of the logic for validate is wrong. I left a TODO in the tests to discuss that
  • I don't understand the else in clean. It recursively calls clean on the object's property, but it passes the same schema? Shouldn't it pass the schema for that property?
  • IMO some of these functions would be easier to unit test if all the utils were attached to a single object. That way when I'm testing a recursive function I can assert that it calls itself for certain test cases which will limit the total number of test cases. Or I can assert that it calls another utility function which I have already tested.

Copy link
Member

@pateketrueke pateketrueke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

@pateketrueke pateketrueke merged commit b1ce36f into json-schema-faker:develop May 1, 2020
@rachidlamouri
Copy link
Contributor Author

@pateketrueke If you look in PR description there were a couple of bullets I was hoping you would address. Mainly the validate function having some unexpected behavior as well as the behavior of the clean function

@pateketrueke
Copy link
Member

Can you open an additional issue to address them? Thank you!

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

2 participants