You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, there is ExampleServer.makeSchema, tho I just noticed i has a wrong docstring. It takes a schema and outputs an example of the schema if specified by an annotation or it attempts to construct one.
Let me just point out that personally, I wouldn't use it instead of fast-check arbitraries for serious testing. It might be alright for some smoke tests, but it won't give you the same safety like a proper property-based testing using the fast-check. Instead, consider constraining your schemas in a way that only valid values are generated by the fast-check arbitraries. For example, in the past I wrote some property tests for a logic storing strings into a postgres and thanks to the fast-check producing various crazy edge case strings I found out it is not possible to store a string containing \0 byte into a TEXT column. The problem wasn't the fast-check producing these values but that my schema was allowing them. So I created a new schema for a "storable string" (using Schema.filter(...)) and as a result my tests started passing but also I actually forbidden these unacceptable strings to be passed from the user of my API.
I understand your use-case might be completely different and the test suite more complex in comparison to this relatively trivial example, but maybe fast-check is actually pointing out some gaps in your validations or maybe the test might be written little bit differently. 🙂
I find it useful for testing as it's output is more predictable than fast-check arbitraries
The text was updated successfully, but these errors were encountered: