Testing functional component methods + typescript
Quite new to writing tests, and have to also jump in the deep end with doing it in Typescript on a project I have some functional component methods placed inside the function that I want to spy on to check if they are called with correct props after a user has performed an…
When to use integration tests over e2e tests?
Hey! Yesterday I tested a feature which required me to mount multiple components and link them via a store and router (in vue). The setup was quite complex and there was a problem with the router which did not call the in-component guards. So I had to manually simulate these…
React-Redux Testing issue
I have a component that I am testing that is using redux, so I looked in RTL and saw the example with redux. I setup 3 tests. If I run this, the 1st and 2nd times are correct, however in the 3rd test which is the same as the 1st it fails and the value is $0. If I comment out the…
How do you test error boundaries?
I have a jest test which checks whether an error is caught by an error boundary. My test runs to completion, passing all the expect()s, but jest still throws an error on the console. I can't work out whether the React component is not consuming the error. Maybe that's a React…
Did getByText change recently?
I have some HTML that looks like this: And we are using a test that does: It used to work fine, but now it's telling me it can't find that phone number. If I switch to doing a RegExp it works, but I'm curious to see if I'm just doing something wrong.