I dipped into Jest & React Testing Library, and managed to integrate them into my Next.js app. But I still have no idea about the best practices, so would someone be so kind to share some awesome posts on this topic? 💕
Well there's this amazing article Why Good Developers Write Bad Unit Tests, it's not focused on react + jest, but most of the philosophy can be used anywhere you're writing tests!
Thanks! This post is of great help! But I don't think it's always right to "keep the reader in your test function", which the author considered a principle. I think it's necessary to extract common logic into another function, like beforeAll and beforeEach in Jest, for stuffs like database mocking.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I dipped into Jest & React Testing Library, and managed to integrate them into my Next.js app. But I still have no idea about the best practices, so would someone be so kind to share some awesome posts on this topic? 💕
Well there's this amazing article Why Good Developers Write Bad Unit Tests, it's not focused on react + jest, but most of the philosophy can be used anywhere you're writing tests!
It also exists as a talk
Thanks! This post is of great help! But I don't think it's always right to "keep the reader in your test function", which the author considered a principle. I think it's necessary to extract common logic into another function, like
beforeAll
andbeforeEach
in Jest, for stuffs like database mocking.