I got the title from a Pluralsight course Testing React Components, and I happened to experience an example yesterday:

queryBy vs findBy vs getBy

Testing library docs provides cheatsheet for queries that list the differences, here I just want to note down one thing that almost tricked me:

If I do:

1
expect(screen.findByPlaceholderText('Card Number')).not.toBeNull()

It will always pass, because findBy query is awaited, and I am expecting the promise not to be null. Instead, I should go with queryByPlaceholderText if I want to know whether the component exists.