Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ReactDay 2022 - Unit testing
Search
Luca Del Puppo
October 19, 2022
Programming
0
110
ReactDay 2022 - Unit testing
Luca Del Puppo
October 19, 2022
Tweet
Share
More Decks by Luca Del Puppo
See All by Luca Del Puppo
Keep alive your typescript definitions using Zod
puppo
0
110
Aware dependencies using Nx Graph
puppo
0
76
Prisma the ORM that node was waiting for
puppo
0
99
How to scale up your projects like a pro
puppo
0
120
Alive, Tipi Sopravvisuti
puppo
0
110
How to scale up your angular projects like a pro
puppo
0
160
Prisma in the Air
puppo
0
420
Can typescript definitions survive even at runtime?
puppo
0
110
Is it possible to build your UI components using only web components?
puppo
0
84
Other Decks in Programming
See All in Programming
CSC509 Lecture 06
javiergs
PRO
0
250
階層構造を表現するデータ構造とリファクタリング 〜1年で10倍成長したプロダクトの変化と課題〜
yuhisatoxxx
3
940
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
240
開発者への寄付をアプリ内課金として実装する時の気の使いどころ
ski
0
360
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
750
CSC509 Lecture 03
javiergs
PRO
0
330
Introducing ReActionView: A new ActionView-Compatible ERB Engine @ Kaigi on Rails 2025, Tokyo, Japan
marcoroth
3
950
チームの境界をブチ抜いていけ
tokai235
0
100
Serena MCPのすすめ
wadakatu
4
910
CSC509 Lecture 04
javiergs
PRO
0
300
CSC305 Lecture 05
javiergs
PRO
0
210
Back to the Future: Let me tell you about the ACP protocol
terhechte
0
130
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Optimizing for Happiness
mojombo
379
70k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
A better future with KSS
kneath
239
17k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
It's Worth the Effort
3n
187
28k
How GitHub (no longer) Works
holman
315
140k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.7k
Faster Mobile Websites
deanohume
310
31k
A designer walks into a library…
pauljervisheath
209
24k
Transcript
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