Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ReactDay 2022 - Unit testing
Search
Luca Del Puppo
October 19, 2022
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ReactDay 2022 - Unit testing
Luca Del Puppo
October 19, 2022
Transcript
13 slides
Unit Testing React Day 2022
Ego Slide Luca Del Puppo (aka Puppo) Full-Stack Developer at
Flowing a Claranet Italian Company @puppo92 https://www.linkedin.com/in/lucadelpuppo/
[email protected]
The Test Pyramid
Jest vs React Testing Library (RTL)
Sporchiamoci le mani Example https://puppo.github.io/reactday-2022-workshop-testing/ Code https://github.com/Puppo/reactday-2022-workshop-testing
React Testing Library Selectors
Single Element Type of Query 0 Matches 1 Match >1
Matches Retry (Async/Await) getBy... Throw error Return element Throw error No queryBy... Return null Return element Throw error No findBy... Throw error Return element Throw error Yes
Multiple Elements Type of Query 0 Matches 1 Match >1
Matches Retry (Async/Await) getAllBy... Throw error Return array Return array No queryAllBy... Return [] Return array Return array No findAllBy... Throw error Return array Return array Yes
Query types - Queries Accessible to Everyone - getByRole -
getByLabelText - getByPlaceholderText - getByText - getByDisplayValue - Semantic Queries - getByAltText (img, area, input) - getByTitle - Test IDs - getByTestId
Thanks!
Give me your feedback
Milano Frontend - 25 Ottobre 2022 Registrazione https://tinyurl.com/zawyva9z
NgRome - 02 Ottobre 2022 Sito https://t.co/7Z4wXMapva Coupon (-15%) LucaCarbonara22
More Decks by Luca Del Puppo
See All by Luca Del Puppo
Keep alive your typescript definitions using Zod
puppo
0
180
Aware dependencies using Nx Graph
puppo
0
110
Prisma the ORM that node was waiting for
puppo
0
150
How to scale up your projects like a pro
puppo
0
170
Alive, Tipi Sopravvisuti
puppo
0
160
How to scale up your angular projects like a pro
puppo
0
230
Prisma in the Air
puppo
0
520
Can typescript definitions survive even at runtime?
puppo
0
200
Is it possible to build your UI components using only web components?
puppo
0
140
Other Decks in Programming
See All in Programming
SODA - FACT BOOK(JP)
sodainc
1
40k
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
320
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
110
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
150
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.4k
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
250
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
160
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
610
Debian JP Projectのサーバー構成
uwabami
1
140
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
270
SODA - FACT BOOK(EN)
sodainc
1
270
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.4k
Featured
See All Featured
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
980
My Coaching Mixtape
mlcsv
0
390
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
680
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
570
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
770
Building the Perfect Custom Keyboard
takai
2
960
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
Highjacked: Video Game Concept Design
rkendrick25
PRO
2
580
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k