React Testing for Beginners: Start Here!

  Рет қаралды 53,747

Programming with Mosh

Programming with Mosh

Күн бұрын

Ready to master React testing? This tutorial covers the essentials of React Testing Library with Vitest / Jest. Get hands-on and start writing better tests today!
🚀 Want to take your skills to the next level?
- Check out my full course "React Testing Mastery": bit.ly/3IBuILB
- Subscribe for more videos like this: goo.gl/6PYaGF
✋ Stay connected:
- Twitter: / moshhamedani
- Facebook: / programmingwithmosh
- Instagram: / codewithmosh.official
- LinkedIn: / codewithmosh
👉 Related tutorials:
- JavaScript Unit Testing Tutorial: • JavaScript Unit Testin...
- React Tutorial for Beginners: • React Tutorial for Beg...
- TypeScript Tutorial for Beginners: • TypeScript Tutorial fo...
👉 Full courses:
- React Testing Mastery: codewithmosh.com/p/react-test...
- React 18 for Beginners: codewithmosh.com/p/ultimate-r...
- React 18- Intermediate Topics: codewithmosh.com/p/ultimate-r...
- Mastering JavaScript Unit Testing: codewithmosh.com/p/mastering-...
- The Ultimate TypeScript Course: codewithmosh.com/p/the-ultima...
📖 TABLE OF CONTENT
0:00:00 - Introduction
0:01:21 - Prerequisites
0:03:00 - Course Structure
0:04:46 - How to Take this Course
0:06:37 - Setting Up the Development Environment
0:07:36 - Setting Up the Starter Project
0:13:31 - Setting Up Vitest
0:17:19 - Setting Up React Testing Library
0:20:24 - Testing React Components
0:21:15 - What to Test
0:24:31 - Testing Rendering
0:33:12 - Simplifying Test Setup
0:36:16 - Exercise: Testing UserAccount
0:41:52 - Announcement
0:42:41 - Testing Lists
0:48:46 - Exercise: Testing ProductImageGallery
0:53:08 - Testing User Interactions
01:02:04 - Exercise: Testing ExpandableText
01:13:17 - Simplifying Tests
#react #reactjs #testing

Пікірлер: 130
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
- Want to learn more? Get the full course: codewithmosh.com/p/react-testing-mastery - Subscribe for more videos like this: goo.gl/6PYaGF
@dodownthing
@dodownthing 2 ай бұрын
Not able to buy this course from above link . The page shows " This product is not available. Contact the school owner for more information." Please check .
@user-yz2mv8kn4x
@user-yz2mv8kn4x 2 ай бұрын
same here@@dodownthing
@HeyMr.OO7
@HeyMr.OO7 2 ай бұрын
Chutiya course 😂😂😂
@JayCraft-mf2pt
@JayCraft-mf2pt 2 ай бұрын
@programmingwithmosh please I couldn't download the Python & SQL cheat sheets. It's given a response of the security certificate expiring 165days ago. It advised not to go further as it's unsafe for my PII in my device. Please help
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
@@JayCraft-mf2pt I’m sorry to hear that! I took a note and will fix it tomorrow morning.
@invertedcoder
@invertedcoder 2 ай бұрын
Mosh has got some insane skilles
@tonishant
@tonishant 2 ай бұрын
One of the best tutor on YT.
@bcb3548
@bcb3548 2 ай бұрын
Was looking up Vitest yesterday and Mosh drops this! Couldn't have been more auspicious.
@pandalife1313
@pandalife1313 2 ай бұрын
This is the first video that explains everything about React Testing indetails and in a clear format. Thank you so much Mosh
@mohammadyusuf4371
@mohammadyusuf4371 23 күн бұрын
I am learning a lot from your videos and glad to have the membership 🙏 Thanks Mosh for being there!
@user-ks7py9ob9h
@user-ks7py9ob9h 2 ай бұрын
The method of instruction is fantastic. Many thanks, Mosh 💌
@SaadxBaig
@SaadxBaig 2 ай бұрын
Can’t wait to learn more about testing in react Mosh! The best teacher out there
@ky8designs
@ky8designs 2 ай бұрын
Thank you Mosh for your efforts, I loved programming because of you.
@adamadiengba6928
@adamadiengba6928 2 ай бұрын
Good job again Mosh. So, Modern Angular testing course would be appreciated.
@davidomiunu782
@davidomiunu782 2 ай бұрын
Perfect timing. I’m excited about this video
@catalinionescu5658
@catalinionescu5658 Ай бұрын
Best course on react testing on YT. Thanks Mosh!
@JIPP71984
@JIPP71984 2 ай бұрын
Looking forward to completing this one Would love a spring boot course from you one day.
@KzCorp-jt4te
@KzCorp-jt4te Ай бұрын
Wow... this tutorial was amazing. One of the best on testing that I have seen.
@juanmacias5922
@juanmacias5922 2 ай бұрын
This was such a great tutorial! I've been wondering how TDD would work with UI, and this helped me understand how I could go about it, thanks!
@AnuragArwalkar
@AnuragArwalkar 2 ай бұрын
Thanks a lot, Mosh, for your detailed programming videos
@jlimsy1
@jlimsy1 29 күн бұрын
The only course on React testing that I managed to complete without hitting unsolvable bugs left and right
@DigitalCreator5
@DigitalCreator5 2 ай бұрын
Hurray 🎉 thanks mosh 😂
@roelaneroy2588
@roelaneroy2588 2 ай бұрын
Thank you, Mosh! for this great tutorial. For sure, the full course on this is third course I'm going to buy from you. 🏆🏆
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Awesome, thank you for your support!
@cameronerasmus633
@cameronerasmus633 Ай бұрын
Hi Mosh! First off - I just want to thank you for your incredible lessons. You have a gift, very few people can explain anything code as well as you do. I'm a high school science teacher myself, so I understand how much work it takes. I came across your courses for the first time in early 2022. A few dozen hours of Mosh that lead to a few dozen projects, that finally lead to my first job as an engineer! You sparked a passion inside of me that I never new I had - I will be forever grateful. Thank you, Mosh. Would you ever consider doing a course on microservices? Maybe using the MERN stack. I would buy that course a dozen times over and recommend it to every human being I know - coder or otherwise!
@programmingwithmosh
@programmingwithmosh Ай бұрын
Thank you for your kind words. Microservices is one of those overrated technologies I’m reluctant to teach as it educates bad habits. The hype is already over and more and more people are getting back to monolith.
@SkillsMatterTouhidSayed
@SkillsMatterTouhidSayed 2 ай бұрын
Hi mosh, Is any chances to have a Springboot course?
@cywiz
@cywiz 2 ай бұрын
Please update react native and nodejs course..... Or please let us know if backend does not have any breaking changes... And......lots of 💕 love, for being there for every self taught programmers
@webmobile21
@webmobile21 Ай бұрын
updated react native course that includes testing title as well
@exposetheworldfacts
@exposetheworldfacts 2 ай бұрын
❤❤My dear Mosh I am too much inspired by your methodology of teaching. I love it! Please make a complete tutorial on Flutter and also on Django framework
@JOJO_THE_PROGRAMMER
@JOJO_THE_PROGRAMMER 2 ай бұрын
Awesome course Mosh
@nurudeenhamzah5011
@nurudeenhamzah5011 2 ай бұрын
Quality videos from Mosh, expect no less ❤
@maicaotri3668
@maicaotri3668 2 күн бұрын
Thanks a lot, good for understanding
@jessewakukha1196
@jessewakukha1196 2 ай бұрын
Nice one mosh...from Nairobi kenya
@madinafest
@madinafest 2 ай бұрын
Also following from Nairobi, Kenya. 🔥⚡💥
@Noor-e-islam587
@Noor-e-islam587 2 ай бұрын
You are unique sir
@ko9
@ko9 2 ай бұрын
Will this be just as applicable for a NextJS project, or are there significant differences in testing NextJS apps?
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
For the most part, yes! The knowledge you learn in the course can be applied to a Next.js project because you’re still dealing with React components. But routing in Next.js is different from what we’ve covered in the course.
@dedstronk
@dedstronk 2 ай бұрын
@@programmingwithmoshwhy not also add section for nextjs since you also teached or make a course for testing nextjs application since its rare to find some?
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
My goal is to teach you to fish rather than feed you fish. With the materials I put together in this course, you won’t need me in the future and can figure out the rest on your own.
@ibrahimolammy471
@ibrahimolammy471 Ай бұрын
Thanks Mosh for these tutorials, you're indeed a great tutor. I'd like to know if you have the intention of creating a PHP course.
@orisfinatech705
@orisfinatech705 24 күн бұрын
Thanks for this amazing course. I would love to ask, as a beginner should I focus on writing test cases before code or write my code and then write test cases to see if my code passes those test cases
@deepakjha4138
@deepakjha4138 2 ай бұрын
great tutorial
@shakyadissanayaka
@shakyadissanayaka 2 ай бұрын
Thank you very much sir
@UniqueEdit243
@UniqueEdit243 2 ай бұрын
Our legend comes back again. ❤❤
@mutabazi250-hj1jb
@mutabazi250-hj1jb 2 ай бұрын
Cool👍keep it up bro
@SteveNewman1955
@SteveNewman1955 2 ай бұрын
hi mosh , is there any chance to have a series on spring and microservices i really love the way you teaching and i cant understand the other instructors ... recently i finished your java series and i really love it l'm looking for job in backend development really really appreciate that if you help me .... thanks ❤
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Thank you very much! I have spring on my list but I’m not sure where I’ll be work on it as there are many other topics that students have requested more.
@user-ll4qy6cg9i
@user-ll4qy6cg9i 2 ай бұрын
Should we test hooks and and context alone or only in the components where they are used?
@fireheart__7
@fireheart__7 2 ай бұрын
Awesome!! ❤
@Followme841
@Followme841 2 ай бұрын
Mosh, can you please add ( the dom ) in your java script course with some best practice exercises and also ( async await ) please❤
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Great suggestion!
@user-ll4qy6cg9i
@user-ll4qy6cg9i Ай бұрын
Hi Mosh would it be possible you could show how you would test your ErrorPage in this project? I have the same structure on my ErrorPage and i got this error, Error: useRouteError must be used within a data router, I guess it is since i use createBrowserRouter and i'm not sure how to mock it.
@mylesgideonprospero
@mylesgideonprospero 2 ай бұрын
I am trying to comprehend how do people write test modules without knowing the production code beforehand when they do Test Driven Development approach Nonetheless, thank you for providing this and the timing is crazy since I only started looking into testing recently. Out of thousands of tutorial videos, I will always pick your videos. I appreciate your well-thought out content as always ~
@efraim-andrade
@efraim-andrade 28 күн бұрын
Great video 👏, what vscode theme is this ?
@valenciawalker6498
@valenciawalker6498 2 ай бұрын
Thank you
@josephajibodu2377
@josephajibodu2377 2 ай бұрын
The Legend 🚀
@AnonymousCoder7
@AnonymousCoder7 2 ай бұрын
Hey Mosh Any plans on system design course or Machine learning course .. these topics would be great to make a course on... Thoughts ??!
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
I was thinking of it for a while but got distracted with a million things! Thanks for the reminder. I’ll see what I can do, but no promises! ;)
@HeyMr.OO7
@HeyMr.OO7 2 ай бұрын
@@programmingwithmosh I really believe you could do a great course on Cloud computing, ML, System Design or may be iOS development. Pls give a small reply if you read this 🙌🏻
@AnonymousCoder7
@AnonymousCoder7 2 ай бұрын
​@@programmingwithmoshyeahh mosh .. I think he is correct... We're friends Pls consider above topics if you can manage .. wud be great.. pls like/reply if you read this 💙
@RKSharma019
@RKSharma019 2 ай бұрын
​@@programmingwithmosh Hey Mosh these are really great courses ... will you pls. Consider ??! 👍🏻
@natalias.2267
@natalias.2267 2 ай бұрын
Hi, do you accept cards from any country? I have problems with payment
@HeyMr.OO7
@HeyMr.OO7 2 ай бұрын
Hey Mosh, Should I buy your Rect 16 course instead of 18 ? Coz that's lot cheaper for me at this beginner stage . I just wanna learn the react ⏳🤔🤔
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
I wouldn’t recommend that as so much has changed since then!
@webmobile21
@webmobile21 Ай бұрын
is vitest applicable for react native
@devoni_com
@devoni_com 2 ай бұрын
Hello sir, I want to learn and participate in your courses, but I have a question: Can a person who does not know anything about programming follow this course that you will offer? Will I be ready for the job market and have sufficient experience?
@dakshkumar4032
@dakshkumar4032 2 ай бұрын
amazing
@user-cn9oo5uw6f
@user-cn9oo5uw6f 2 ай бұрын
Will you put this course on Udemy ? My company provided me a udemy business acct n I would like to take advantage of tht
@bleir82
@bleir82 12 сағат бұрын
Hi! I want to try this but during running npm start I have error "TypeError: this.spawn is not a function" this I think is from concurrently :( I have tried on node 20.10 and newest one 22.1
@Cloudscloud7300
@Cloudscloud7300 2 ай бұрын
Thank you, Can we have video for Building Large language model for beginners ?
@mutabazi250-hj1jb
@mutabazi250-hj1jb 2 ай бұрын
Well be back Mr Mosh, after sometime
@sukreth1413
@sukreth1413 2 ай бұрын
Hi can you make video about how to print first n perfect number in python I searched in internet and chatgpt it has no correct solution only printing first 8 perfect numbers
@Ninjacode554
@Ninjacode554 Ай бұрын
My teacher, makes a testing course with jest and react native testing library, please 🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@jayanthkumar6859
@jayanthkumar6859 2 ай бұрын
mosh please make a course on go and rust
@thaifred
@thaifred 2 ай бұрын
How could i access my base_url from my config.json file?
@mehdiskan
@mehdiskan 2 ай бұрын
😍Eyval Mosh, In Course Awliee;
@Nyanda_Jr
@Nyanda_Jr 2 ай бұрын
Hello Sir. Nice being here
@moewai6256
@moewai6256 Ай бұрын
Why we need so many library to use? react-testing library, jsdom and jest-dom
@burhaanhassan5498
@burhaanhassan5498 2 ай бұрын
I am more interested to see how you implemented the frontend, that can teach us a lot also it summarise the most important skills of react js. Please if you can share with us. sure, we can Colone the repo and see how it's build but Wanna see you doing it
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
The project has a GitHub repo. I explained that at the beginning. Feel free to clone the project and study it. If you learn better by videos, I've covered all the tools and techniques used in this project (except auth) in my React Intermediate course: codewithmosh.com/p/ultimate-react-part2
@rakeshmaurya5148
@rakeshmaurya5148 2 ай бұрын
Sir i am fig fan of you. I want to purchase your pro course.
@MohammadMansourBone
@MohammadMansourBone 2 ай бұрын
Finally 🙌
@ar-swe
@ar-swe 2 ай бұрын
please make ts node backend series mosh
@ShakkeerTheCoder
@ShakkeerTheCoder Ай бұрын
Mosh, we need tutorial on GraphQL
@kamauwaweru4991
@kamauwaweru4991 2 ай бұрын
i love it
@mehakgrover2174
@mehakgrover2174 2 ай бұрын
Mosh please make tutorial on flutter
@azharqureshi9814
@azharqureshi9814 Ай бұрын
Can we download the course after purchasing from mosh site ? Anyone has experienced this?
@programmingwithmosh
@programmingwithmosh Ай бұрын
You can download individual videos.
@oussemabouyahia474
@oussemabouyahia474 17 күн бұрын
how many times , did you repeat that you have 20 years experience in software
@rashidkhanjamali4358
@rashidkhanjamali4358 2 ай бұрын
Mosh please Upload zero to mastery Full Stack development
@arikmosfor4907
@arikmosfor4907 2 ай бұрын
what theme are you using?
@gaurav455
@gaurav455 2 ай бұрын
It's oh lucy.
@SANTOSHYADAV-fx6fu
@SANTOSHYADAV-fx6fu 19 күн бұрын
is this course is on Udemy ?
@hzakaria5338
@hzakaria5338 2 ай бұрын
Mosh why you dont give online courses for react native mobile app development ,, there are a lot of complications just to implement the environment 😞
@user-fb1vi6pn3w
@user-fb1vi6pn3w 2 ай бұрын
Hello mosh we need update on your .net course
@ed-vm1gb
@ed-vm1gb 2 ай бұрын
vscode theme?
@sahandmahdavi6134
@sahandmahdavi6134 2 ай бұрын
Can be also used for React Native?
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Yes! Most of the techniques and best practices you learn in the course can be applied to React Native projects. You just need to install React Native Testing Library, instead of React Testing Library.
@sahandmahdavi6134
@sahandmahdavi6134 2 ай бұрын
@@programmingwithmosh Thanks Mosh!
@sahandmahdavi6134
@sahandmahdavi6134 2 ай бұрын
@@programmingwithmosh That's amazing, I was watching the KZbin 1H introduction and it seemed to be practical. On the other side I think if you can give us a course of Vue.js, would be helpful TBH.
@LemonGaming43021
@LemonGaming43021 2 ай бұрын
I want you to update your node js series course because your node course is out of date.
@minimalsforlife740
@minimalsforlife740 2 ай бұрын
❤❤❤
@raghavenderkuppireddy7158
@raghavenderkuppireddy7158 2 ай бұрын
❤❤❤❤❤
@dimarialara5752
@dimarialara5752 2 ай бұрын
Do php please🥺
@durgaprasad-vm4mh
@durgaprasad-vm4mh 2 ай бұрын
I am unable to buy this course. Encountering fallowing error: "This product is not available. Contact the school owner for more information."
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Sorry! That was a temporary issue. It's fixed now. Try again and let me know if it's still happening on your end.
@doict7788
@doict7788 2 ай бұрын
Going one course to another....
@christopheradolphe
@christopheradolphe 2 ай бұрын
That's exactly the course I was looking for. I bought it because I really like your teaching style and I know it's worth every dollar. I have never been disappointed with any of the courses, so thank you @programmingwithmosh for creating such great content.
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
Thank you so much for your support and lovely words! 🙏
@christopheradolphe
@christopheradolphe 2 ай бұрын
You are welcome@@programmingwithmosh My goal this year is to improve my React skills and I'm sure that by the end of this course that goal will be achieved.
@artsycoder533
@artsycoder533 Ай бұрын
Nice tutorial! Im following along and im getting a failing test when testing for the absence of the edit button if the user is not an admin. it("should not render edit button if user is not admin", () => { const user: User = { id: 1, name: "My Name" }; render(); const button = screen.queryByRole("button"); expect(button).not.toBeInTheDocument(); }); its still finding the edit button: expected document not to contain element, found Edit instead ive added console logs in the UserAccount component to see the value of isAdmin as well as if the button is being rendered and both are logging false: console.log("user.isAdmin:", user.isAdmin); console.log("Button rendered:", user.isAdmin && Edit); when i run screen.debug() i do see that the edit button is in fact not there in the 3rd test case, i just do not understand why the test is failing? User Profile Name: My Name has anyone ran into this?
@thaifred
@thaifred 2 ай бұрын
Hi Mosh, i discovered when i test with react query this import in the testfile fails import { QueryClient, QueryClientProvider } from '@tanstack/react-query'. but this work import { QueryClient, QueryClientProvider } from 'react-query', do you have any ideas why? I using the latest version "@tanstack/react-query": "^5.24.2". And how come u use version 3? Thanks in advance 😁
@programmingwithmosh
@programmingwithmosh 2 ай бұрын
If you’re talking about the project I’ve used in the course, the correct installed package is react-query. But I think they renamed it to @tanstack/react-query in a newer version. Check the package.json to see what is installed.
@thaifred
@thaifred 2 ай бұрын
Solved it, since i installed "@tanstack/react-query": "^5.24.2". it didn't update react-query since i guess that version where not part of the tanstack, so by unistall react query it worked. Leave it here as ref if somebody else get the same issue, thanks for an great tutorial i taking the full course.
@devbyali
@devbyali 2 ай бұрын
We need a spring boot course
Object-oriented Programming in 7 minutes | Mosh
7:34
Programming with Mosh
Рет қаралды 3,7 МЛН
JavaScript Unit Testing Tutorial for Beginners
48:32
Programming with Mosh
Рет қаралды 49 М.
ОДИН ДОМА #shorts
00:34
Паша Осадчий
Рет қаралды 5 МЛН
skibidi toilet 73 (part 2)
04:15
DaFuq!?Boom!
Рет қаралды 31 МЛН
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 303 М.
Testing In React Tutorial - Jest and React Testing Library
21:28
The FASTEST Way to Learn to Code & Get a Job
5:48
Programming with Mosh
Рет қаралды 74 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 132 М.
React Tutorial for Beginners
1:20:04
Programming with Mosh
Рет қаралды 2,4 МЛН
Why Vitest Is Better Than Jest
13:13
Web Dev Simplified
Рет қаралды 125 М.
5 Mistakes That Are Killing Your Coding Progress
3:42
Programming with Mosh
Рет қаралды 39 М.