[Unit testing - React] getBy*, queryBy*, findBy*

Sync api:

  • getBy*
  • queryBy*

 

Async api:

  • findBy*

 


 

For sync api, when to use which?

  • queryBy*: when the element is not always shown on screen
  • getBy*: when the element always shown on screen

 

When to use async api?

  • findBy*: when show/hide elements depends on a promise / timer
posted @ 2024-05-07 14:32  Zhentiw  阅读(3)  评论(0编辑  收藏  举报