Test React components with React Testing library & Jest

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ต.ค. 2024

ความคิดเห็น • 16

  • @Ebizzill
    @Ebizzill 3 ปีที่แล้ว

    this is by far the most in depth testing I've had encountered. Super thorough, especially the way you approached fetch Mock data

  • @hasand6814
    @hasand6814 3 ปีที่แล้ว

    Very useful, Thanks a lot

  • @horacinis
    @horacinis 3 ปีที่แล้ว

    I'm hating testing right now! Thanks for the video though

  • @Ebizzill
    @Ebizzill 3 ปีที่แล้ว

    I'm getting a ` Warning: An update to Steps inside a test was not wrapped in act(...).` how should i fix it ?

    • @codepanion
      @codepanion  3 ปีที่แล้ว

      Hmm, not sure what might be a problem. You can try with "waitFor" after the render method?

  • @varunchandwani
    @varunchandwani 3 ปีที่แล้ว

    Any git url for your demo ? Thanks

    • @codepanion
      @codepanion  3 ปีที่แล้ว

      I don't have it currently, I will create a repo when I have more time.

    • @codepanion
      @codepanion  3 ปีที่แล้ว

      I added a git repo in the video description.

  • @80Vikram
    @80Vikram 3 ปีที่แล้ว +1

    so is this "Unit Testing" or "Integration Testing" ?

    • @codepanion
      @codepanion  3 ปีที่แล้ว +2

      It's more integration testing, except the test for "AddNewPostBtn" component which is unit test.

    • @80Vikram
      @80Vikram 3 ปีที่แล้ว

      @@codepanion thanks , could you please clarify more on these terms as it is quite confusing for beginner

  • @137dylan
    @137dylan 3 ปีที่แล้ว

    I'm half way through this video and you've spent 5x more time creating the UI/JSX than you have actually testing. I thought the main purpose of this video was React Testing Library and Jest.
    Also I would suggest increasing the view (font size) of your IDE for future videos as it's easier for the viewer to read.

    • @codepanion
      @codepanion  3 ปีที่แล้ว +2

      Thank you for your feedback. I think it's very important to be familiar with functionalities that you want to cover with your tests, so in my opinion there is no better way than creating each component from scratch and present the full process. I will add timestamps when I have some time, so people can easily navigate through the video, but still you can always speed up some parts. Regarding the font size, I agree with you. Cheers!

  • @caseyvandyke7051
    @caseyvandyke7051 3 ปีที่แล้ว

    act is not defined

    • @edinburghrules
      @edinburghrules 3 ปีที่แล้ว +3

      you need to import it from 'react-dom/test-utils' at the top of file.
      e.x.
      import { act } from "react-dom/test-utils";