React Testing Library Crash Course

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 157

  • @liornitzan4602
    @liornitzan4602 3 года назад +16

    Good introduction to React Testing Library.
    Very clearly explained.
    I do have a few remarks though:
    1. It wouldn't hurt to explain that we are using Jest as our testing environment and that the functions "test" and "expect" for example are Jest functions.
    2. It is recommended to call queries like getBy... etc., on the screen method imported from the testing library rather than on the return value of render. This is recommended by the official docs.
    3. It is recommended to use userEvent rather than fireEvent to trigger, well, user events.
    4. It would help to explain the "Arrange" - "Act" - "Assert" testing methodology.
    5. Regarding getByTestId - As already mentioned in another comment, it is recommended in the official docs to only use it if there is no other way, and there usually are alternatives.

  • @EverAfterBreak2
    @EverAfterBreak2 3 года назад +12

    Commeting so the algo helps this guy to get more viewers he deserves it.

  • @pranav854
    @pranav854 3 года назад +26

    Please keep posting more testing-related content. This is incredible and there isn't much testing-related videos out there!

  • @codingwithdidem
    @codingwithdidem 3 года назад +37

    Hello, this video deserves much more attention guys!

  • @joshferriday8966
    @joshferriday8966 3 года назад +26

    Dude this is an awesome video! I've been trying to wrap my head around this all day and your video was the best introduction I found :)

    • @romimaximus
      @romimaximus 3 года назад

      yes, this is awesome, 👍, because all the videos that i found about testing, its somone adding some numbers, that has nothing to do with testing ,

  • @AlgorithmDoctor
    @AlgorithmDoctor 3 года назад

    This is the best React test crash course on RUclips. Keep up the good job.

  • @rohitv3955
    @rohitv3955 3 года назад +1

    Your video deserves a lot more views! Damn, never been this hooked (no pun intended) on a long programming video.

  • @nosmoking586
    @nosmoking586 3 года назад

    I have many paid course that teach Unit Test on React. But this is by far the best tutorial that I have ever watched.

  • @raulmartinezjr7708
    @raulmartinezjr7708 3 года назад

    The best React Testing crash course :) Keep it up!

  • @sreeananthakannan
    @sreeananthakannan 3 года назад

    One of the best videos to understand react unit test.......

  • @calebolojo5246
    @calebolojo5246 3 года назад

    This is by far the best video on TDD. Great job!

  • @CoreyGumbs
    @CoreyGumbs 3 года назад +1

    Best tutorial ive seen so far on tdd. Thank you for explaining everything

  • @haruwiki
    @haruwiki 3 года назад +8

    thank you for the video! by far the best RTL tutorial imo. Can you also make a video showing testing with async actions?

  • @kunaljain0212
    @kunaljain0212 3 года назад

    I have seen your GraphQL course, React with Typescript course, Docker Course and now this!!! Can't thank you enough for such informative videos man!

  • @franklinmoon2579
    @franklinmoon2579 3 года назад +1

    You're so good! I've been hunting for a teacher who doesn't just 'do the code' but explains the why. 10/10 Keep it up

  • @nardove
    @nardove 2 года назад

    Thank you very much for the tutorial, easy to follow and engaging. The only comment I have is that I got a few eslint warnings, I did manage to fix them all after I finish the video but it did confused me a bit, so explaining that possible scenario could happen at the beginning would be great

  • @tealle467
    @tealle467 2 года назад

    fireEvent (42:00) didn't work properly, after some research i found the solution, i imported waitFor and had to write this to make it work waitFor(() => expect(inputEl.value).toBe("5"));

  • @kazeemkazeem3204
    @kazeemkazeem3204 2 года назад

    This is pure gold. Thanks for this..

  • @2271masoud
    @2271masoud 3 года назад +1

    thanks for sharing your knowledge. 1:09:40 can be written in a simpler form : className={ counterValue >= 100 ? 'green' : counterValue

  • @asim-gandu-phenchod
    @asim-gandu-phenchod 2 года назад

    Bravo. I have seen a lot of your tutorials and they are compact and well explained. Thank you so much

  • @hendridgonzalez1765
    @hendridgonzalez1765 3 года назад

    Awesome course!!!! Recomended 100%

  • @yogajourney9519
    @yogajourney9519 3 года назад +2

    Every single time I need to know something, Laith Harb has an amazing and recent crash course covering exactly what I'm trying to learn.

  • @deepwebtube
    @deepwebtube 3 года назад

    Yes, great stuff!! Impressed with your simple and lucid examples.

  • @ssaarahj
    @ssaarahj 3 года назад

    Best hour and a half of my life! This video deserves so much more attention.

  • @vikas28978
    @vikas28978 3 года назад

    Great video. Explanation are done with appropriate details

  • @pottaz
    @pottaz 3 года назад +2

    Great tutorial. Especially for someone starting out with the React ecosystem. Can you make a video using React Typescript with context API, HOC and testing? Think that will tick a lot of viewers' boxes. That will basically be the full package. The way you describe everything is very clear and straight forward. Keep up the great work!!!

  • @2CPT1MP
    @2CPT1MP 3 года назад +1

    That's some really high quality content

  • @NihilismEnjoyer98
    @NihilismEnjoyer98 3 года назад +2

    Thanks for the effort you've put in. Hope this video gets the attention it deserves :)

  • @mayankchauhan6680
    @mayankchauhan6680 3 года назад

    Brother, before your video I was kind of afraid of TDD but now I am in love with it. I really liked this way of development. Thanks Bro

  • @veremox
    @veremox 3 года назад

    very nice, man! I struggled a bit with this lib until I realized it's logic is something like cascading css lol.
    helped a lot! thanks

  • @MinhazRaufoon1567
    @MinhazRaufoon1567 3 года назад +1

    This deserves more views

  • @jamoliddinz
    @jamoliddinz 3 года назад

    this is really good. finished in one sit and learnt a lot. thank you

  • @SyamKumarVoleti
    @SyamKumarVoleti 3 года назад +1

    Thank you for the wonderful crash course. Subscribed :)

  • @chandramouli39
    @chandramouli39 3 года назад

    Superb video. Very clear and concise explanation.

  • @thulioguirellehorta1382
    @thulioguirellehorta1382 3 года назад +2

    This is the best approach I had about testing, you convinced me to follow the TTD way of coding because it's pretty fun. Congratulations!!!

  • @yaaibaadi
    @yaaibaadi 3 года назад

    Thanks for this video, it really helped me, may you be blessed with peace and happiness

  • @programmertik2046
    @programmertik2046 3 года назад

    Man why is he Underrarted !!!Awesome teaching bro !!!Loved it !Though i came here from Net NInja .

  • @OSCAR-CH
    @OSCAR-CH 3 года назад +1

    Hey bro, awesome video! Very interesting and quickly to understand. Hope you make more videos about testing. Thanksss

  • @zaquielrodriguezarce2500
    @zaquielrodriguezarce2500 2 года назад

    Awesome video, so useful!
    thank you so much for this content.
    10/10 explanation

  • @viveksharma-tt5nj
    @viveksharma-tt5nj 3 года назад

    thank you for explaining RTL in such a simple way, really appreciate you efforts.

  • @mugiwaranoDave
    @mugiwaranoDave 3 года назад

    Thanks. Been looking for a good TDD crash course in React for some time now

  • @123thebruno
    @123thebruno 3 года назад

    The first time I tried to understand TDD my brain cried, now things are clearer. try to make more videos on the subject, RUclips content is lacking about unit tests in web components. this video helped me a lot, thanks.

  • @randomcell708
    @randomcell708 3 года назад +1

    Great explanation Laith. I know everyone has their own way of doing things, but you really explained the concepts well

  • @egzonberisha9906
    @egzonberisha9906 3 года назад

    This is the best video for introduction to testing

  • @damanvir_saini
    @damanvir_saini 3 года назад +1

    Thank you for this video. It is very informative. It really help me to understand the concepts.

  • @sharewithamar
    @sharewithamar 3 года назад

    Thanks for the video. A series or course on complete react testing unit, end to end, integration will be helpful for learners.

  • @adityabhadange1631
    @adityabhadange1631 2 года назад

    Thanks alot. This is wonderfully explained! 👍🏻

  • @swistek00
    @swistek00 2 года назад

    just for a correct react code
    const addToCounter = () => {
    setCounterValue((prev) => prev + inputValue);
    };
    const subtractFromCounter = () => {
    setCounterValue((prev) => prev - inputValue);
    };

  • @aadil4236
    @aadil4236 3 года назад

    Best react-testing tutorial.
    Would appreciate tutorial on testing async functions in react...

  • @tonypeirson6282
    @tonypeirson6282 3 года назад

    Excellent content. Subscribed 👍

  • @sinanyaman2007
    @sinanyaman2007 3 года назад +1

    This is some quality content :)

  • @gian5138
    @gian5138 3 года назад

    Instead of parseInt you can just do +e.target.value to convert it to number

  • @nrbrtbns
    @nrbrtbns 2 года назад

    Thanks for that video! Very helpful to a React testing newbie like me.
    Regarding the test for the title color (red/green):
    Isn't there an option to check the "real" color of the title instead of checking the class name?
    To me, the class name is an implementation detail. It is not guaranteed that a class name "green" will be mapped to a green title.

  • @havefun5519
    @havefun5519 Год назад

    Thanks for the tut of TDD.

  • @claudio513
    @claudio513 2 года назад

    Hi, I'm kina new to the TDD and i m trying to follow along. Not a blocking problem but i was wondering if there was an addon or something is missing in my configuration because when i geto to (26:60) component.G intellisense doesnt recognize all the available query.
    thanks in advance for you re time

  • @diegazo5556
    @diegazo5556 2 года назад

    This WAS very informative.Like and suscribed.

  • @MrWildmore
    @MrWildmore 3 года назад

    thanks, you put a lot of effort here, totally useful for me, great work!

  • @cliffordowusuamponsah9532
    @cliffordowusuamponsah9532 3 года назад +1

    Can you please make the source code available? @Laith Harb

  • @Zeuchon
    @Zeuchon 3 года назад

    The logic at approx 1:10 about the className could be solved without use of Template Strings like this:
    className={
    counterValue >= 100 ? "green" : counterValue

  • @hardikganatra2453
    @hardikganatra2453 3 года назад

    Mann , This was so so amazing , you earned a sub definitely , Thanks

  • @mahendranath2504
    @mahendranath2504 3 года назад

    Thank you so much, I liked your channel, immediately subscribed, notified, and like, excellent channel to learn

  • @꿀꿀-j6y
    @꿀꿀-j6y 3 года назад

    Thanks for this video! It helped me a lot

  • @codingpaddy9308
    @codingpaddy9308 3 года назад

    Excellent video, thank you!

  • @siva1033
    @siva1033 3 года назад

    can I check if my functional component returns Null. if yes how do I do it. I tried but found nothing.

  • @mohamadilhamramadhan6354
    @mohamadilhamramadhan6354 3 года назад

    This is so awesome dude, thanks!

  • @uguremirmustafaoglu40
    @uguremirmustafaoglu40 2 года назад

    Is it a good idea to hold all the buttons and input elements etc. in the global scope to keep code dry?

  • @orubenlopes
    @orubenlopes 3 года назад

    The is some very high quality crash course. Thank you very much for sharing knowledge with the community!

  • @rezabozorgi311
    @rezabozorgi311 3 года назад

    thank you.
    In some cases we need state and props to be here in our tests. for that cases which way should we supposed to pass?

  • @MrR0gerrabbit
    @MrR0gerrabbit 3 года назад

    This was an amazing, highly efficient crash course. Thank you so much!

    • @chilly2171
      @chilly2171 3 года назад +1

      except multiple bad practises.

  • @floppy_keyboard
    @floppy_keyboard 3 года назад

    The lack of consistency on using double quotes, single quotes, semi colons, and no semi colons is driving me crazy. It's a good tutorial though, thank you!

  • @QuGhZx
    @QuGhZx 3 года назад

    Thank you! I've noticed that the `instanceof Window` check fails when running `npm run test` when compared to running in the browser. It seems like the test script is passing a window object that is not an instance of the Window interface. This has forced me into the inconvenience of updating my type checks and doing unnecessary type casting.

  • @MyRc16
    @MyRc16 2 года назад

    Learning so much from you bro, thank you so much, second course i complete from your list n.n

  • @KennyCarter90
    @KennyCarter90 3 года назад +1

    Good video, thank you!

  • @ahmedtohamy3258
    @ahmedtohamy3258 3 года назад

    Great course !

  • @TylerpFarris
    @TylerpFarris 3 года назад

    Such a concise tutorial, thank you!

  • @thesanju95
    @thesanju95 3 года назад

    Hi, really helpful. What font are you using in the terminal and VScode?

  • @nanonkay5669
    @nanonkay5669 3 года назад

    28:50 don't tell me I was the only one that caught this moment right here lmao, I see you

  • @benyamin4634
    @benyamin4634 2 года назад

    thanks . but what is the different between this crash course and your ninja test crash course?

  • @manjunathdevendran1516
    @manjunathdevendran1516 3 года назад

    So far its intersting. Question: if your functional component does not import React component, test fails with Reference Error. Why does a functional component need React import though it's not used ?

  • @anakgoa0655
    @anakgoa0655 3 года назад

    thank you for this tutorial bro.. it's really help me, and I hope in the furute you will make another this Test tutorial like using Jest

  • @vinodailawadi1475
    @vinodailawadi1475 3 года назад

    Hi. I have doubt.Are you using jest library?

  • @nicolaslp4630
    @nicolaslp4630 3 года назад

    Nice explanation, thank you sir!

  • @romanprokopets3693
    @romanprokopets3693 3 года назад

    Thank you for this video, really useful and fascinating

  • @reikoleci4303
    @reikoleci4303 2 года назад

    best video around

  • @emirsalihovic6616
    @emirsalihovic6616 3 года назад

    Well done!

  • @kenlee2284
    @kenlee2284 3 года назад +1

    it's really helpful! thanks.

  • @rabinarayansahoo8695
    @rabinarayansahoo8695 3 года назад

    Superbly explained....

  • @polebk193
    @polebk193 3 года назад +1

    good stuff!

  • @panicogalactico7379
    @panicogalactico7379 3 года назад

    That was really good!! thanks!!

  • @niravpanchal6254
    @niravpanchal6254 3 года назад

    Very Well Explained!

  • @amiturfnd
    @amiturfnd 3 года назад

    Really helpful, thanks lots bro :)

  • @gmmkeshav
    @gmmkeshav Год назад

    why we are not using jest

  • @ahadalichowdhury24423
    @ahadalichowdhury24423 2 года назад

    Please make testing video like backend node express and mongo

  • @BonBonInoc
    @BonBonInoc 3 года назад

    is this an example of Integration Tests? I'm really confuse with the terms

  • @arcan762
    @arcan762 3 года назад

    What is with the "__test__" directory? Why not "tests" or just have it in the same directory as the component it is for?

    • @pottaz
      @pottaz 3 года назад

      Think it is less likely for you to reference those test files if it is using "__" in front of the test folder. Also when looking at the folders you can easily differentiate what is part of the component and what is part of the tests for the component.

  • @filippetkovski9957
    @filippetkovski9957 3 года назад

    Can you please make a video of testing next.js. Thank you

  • @miltonlopezmontero5440
    @miltonlopezmontero5440 3 года назад

    Teacher thank you, awesome video.

  • @aaqibrasool6341
    @aaqibrasool6341 3 года назад

    you made my day bruh.

  • @LPeraltaV
    @LPeraltaV 3 года назад

    Hi, thanks for this video, so much value in here! I would like to ask how can I test a component that receives props/is connected, I just keep in getting that the app should be wrapped in a provider which it already is, so I don't know how to simulate that behavior. Thanks in advance.

  • @sunnypark2597
    @sunnypark2597 3 года назад

    Thank you so much !