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
Do you recommend a particular way to write the validation tests with vest?
I tought about something basic like this, but maybe is there a better way?
constvalidate=vest.create('form',(formData)=>{formData.foos.forEach((fooObject)=>{test('bar','Must be between 2 and 10 chars',()=>{enforce(fooObject.bar).longerThanOrEquals(2).shorterThan(10);});})});
Thanks,
Mathieu.
The text was updated successfully, but these errors were encountered:
The problem of dynamically generated fields, or fiels queried from the server does come up every once in a while, and the way you handle it is the most straightforward way of doing it. There aren't any drawbacks to using it. It's quite simple to maintain and debug, and I should probably add it to the docs as well. Thank you for bringing that up!
As a side note, in the future I plan on adding test.each() that would behave similarly to jest's test.each function. It would have a built-in integration with vest.only so that skipped fields won't be iterated over to begin with - so you can save some precious runtime perf.
Hi,
Thanks for your work and this package.
I would like to validate objects with a lot of nested structure, like this:
Do you recommend a particular way to write the validation tests with vest?
I tought about something basic like this, but maybe is there a better way?
Thanks,
Mathieu.
The text was updated successfully, but these errors were encountered: