DEV Community 👩‍💻👨‍💻

Discussion on: July 14th, 2022: What did you learn this week?

Collapse
 
ninofiliu profile image
Nino Filiu

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

Collapse
 
mrcaidev profile image
Yuwang Cai

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.