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

Поділитися
Вставка
  • Опубліковано 1 лис 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.

  • @sundayuchegbu2060
    @sundayuchegbu2060 2 роки тому +1

    Awesome... quite helpful

  • @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");

  • @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.

  • @061_suryak4
    @061_suryak4 Рік тому

    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

  • @cherukupalliramanjaneyulu4598
    @cherukupalliramanjaneyulu4598 6 місяців тому

    Thank you so much sir

  • @BalasubramaniamM-d2r
    @BalasubramaniamM-d2r Рік тому

    how to run this test code with sonar-scanner

  • @surajkhadse-c3f
    @surajkhadse-c3f Рік тому

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

  • @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 🙏

  • @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.

  • @Dev-Phantom
    @Dev-Phantom 5 місяців тому

    cool

  • @thomaselster8629
    @thomaselster8629 Рік тому

    𝓅𝓇𝑜𝓂𝑜𝓈𝓂

  • @mihirraval2174
    @mihirraval2174 2 місяці тому

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

    • @codingwithabbas
      @codingwithabbas  2 місяці тому

      Component is not rendering? Can you see any error?

    • @mihirraval2174
      @mihirraval2174 2 місяці тому

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

    • @mihirraval2174
      @mihirraval2174 2 місяці тому

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