Unit Testing in React with Jest - Mock, Snapshots and more

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

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

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

    Subscribed 👍🏼, please create more videos on react testing with Jest and react testing library.

  • @hkhsm359
    @hkhsm359 ปีที่แล้ว

    Nice and very help full video. Thanks for sharing.

  • @BalasubramaniamM-d2r
    @BalasubramaniamM-d2r ปีที่แล้ว

    how to run this test code with sonar-scanner

  • @ScottStrong
    @ScottStrong ปีที่แล้ว

    The method of getting the elements for comments has changed since this video's release. This was giving me an error until I made the following suggested change:
    const comments = await waitFor(() => screen.getAllByTestId("comment")); -> replaced with -> const comments = await screen.findAllByTestId("comment");
    A very minor change, but it fixed an error that was appearing as a result.
    Also, this tutorial was awesome and super helpful! Thanks for making it!

    • @deeksha5626
      @deeksha5626 ปีที่แล้ว

      it has to be replaced with const comments = await screen.findAllByTestId("comment");

  • @sundayuchegbu2060
    @sundayuchegbu2060 2 ปีที่แล้ว +1

    Awesome... quite helpful

  • @dhruvsakariya3129
    @dhruvsakariya3129 2 ปีที่แล้ว +1

    SyntaxError: Cannot use import statement outside a module
    I am getting this error Please help 😥

    • @codingwithabbas
      @codingwithabbas  2 ปีที่แล้ว +1

      Have you added this test script in package.json file?
      "test": "react-scripts test --transformIgnorePatterns node_modules/jest/bin/jest.js/",

    • @dhruvsakariya3129
      @dhruvsakariya3129 2 ปีที่แล้ว +1

      @@codingwithabbas It worked Thank you 🙏

  • @premprakash6673
    @premprakash6673 ปีที่แล้ว +1

    Very helpful video. Could you please make videos on jest and react testing library which includes concepts like jest.spyOn, .mockImplementation, .resolves, .rejects, promise, .mockResolvedValueOnce etc. I am not finding any tutorials on this and in my project these things are heavily used

    • @codingwithabbas
      @codingwithabbas  ปีที่แล้ว

      Hi Prem, I will do it soon. I know these concepts or functions are heavily used in Jest.

  • @surajkhadse-c3f
    @surajkhadse-c3f ปีที่แล้ว

    Hi, How can i test when data coming from API instead dummy data

    • @codingwithabbas
      @codingwithabbas  ปีที่แล้ว

      Will make a details video on that as well.

  • @061_suryak4
    @061_suryak4 2 ปีที่แล้ว

    hi, i got error like could not find react-redux context value; please ensure the component is wrapped in a
    but i also wrapped by provider within store and i change old to latest version please gave me a any solution

    • @codingwithabbas
      @codingwithabbas  ปีที่แล้ว

      Is you App component wrapped in Provider?

  • @chd6085
    @chd6085 ปีที่แล้ว

    hey, how are you getting autocomplete on jest...?

    • @codingwithabbas
      @codingwithabbas  ปีที่แล้ว

      Check is this package (@types/jest) present in your package.json file.

    • @chd6085
      @chd6085 ปีที่แล้ว

      @@codingwithabbas no its not there... where should I put this...? should it be inside any other object or at the root of the package.json object....?

    • @codingwithabbas
      @codingwithabbas  ปีที่แล้ว

      Install it as dev dependency.

  • @cherukupalliramanjaneyulu4598
    @cherukupalliramanjaneyulu4598 8 หลายเดือนก่อน

    Thank you so much sir

  • @Dev-Phantom
    @Dev-Phantom 7 หลายเดือนก่อน

    cool

  • @thomaselster8629
    @thomaselster8629 2 ปีที่แล้ว

    𝓅𝓇𝑜𝓂𝑜𝓈𝓂

  • @mihirraval2174
    @mihirraval2174 3 หลายเดือนก่อน

    Can you give me your mail id I have one question!! My tsx component not rendering 😢

    • @codingwithabbas
      @codingwithabbas  3 หลายเดือนก่อน

      Component is not rendering? Can you see any error?

    • @mihirraval2174
      @mihirraval2174 3 หลายเดือนก่อน

      @@codingwithabbas yes that's why I have to send some code pictures and also explain why I am getting error

    • @mihirraval2174
      @mihirraval2174 3 หลายเดือนก่อน

      Because that is my project which will be deploy on 21 -8+ -2024 can you help me then must help ??