runValidations async testing helper?
See original GitHub issueAs discussed here, async validation checks don’t run in Enzyme. However, we are able to access the form in the test and should be able to wait for an async validation in that context.
Is it a good idea to expose a function to call runValidations
when testing? You could await on its result before querying the enzyme wrapper
Upsides: Can test component markup and behaviour using simulate
Downsides: Have to remember to await on runValidations
before querying the component
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Test Extensions — FluentValidation documentation
FluentValidation provides some extensions that can aid with testing your validator classes. We recommend treating validators as 'black boxes' - provide ...
Read more >Mongoose v6.8.1: Validation
It's a convenient helper for building MongoDB unique indexes. ... validate: { validator: function(v) { return /\d{3}-\d{3}-\d{4}/.test(v); }, message: props ...
Read more >Testing Asynchronous Code - Jest
When you have code that runs asynchronously, Jest needs to know when the code it is testing has completed, before it can move...
Read more >Ruby on Rails 5.0 Release Notes — Ruby on Rails Guides
Active Record Attributes API; Test Runner; Exclusive use of rails CLI over Rake; Sprockets 3; Turbolinks 5; Ruby 2.2.2+ required. These release notes...
Read more >Testing: Helpers - Open Web Components
For example you can call functions, look up dom nodes or inspect the rendered HTML. Test fixtures are async to ensure rendering is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Browsing through a handful of these testing issues, I wasn’t able to determine if “errors” could be triggered with validationSchema/Yup in Enzyme/Jest. Is that something that is now possible with the validateForm? Currently, my “errors” object is always empty regardless of how I try and trigger the validation.
same, can’t manage to have errors object filled after input change / submit / blur … made it async, wait, update wrapper don’t help