question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

runValidations async testing helper?

See original GitHub issue

As 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:closed
  • Created 6 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
buchanafcommented, Jun 9, 2018

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.

0reactions
capsule5commented, Apr 26, 2019

same, can’t manage to have errors object filled after input change / submit / blur … made it async, wait, update wrapper don’t help

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found