How to Mock a REST API Server for Testing with Jest & React Testing Library

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

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

  • @gmjitendra
    @gmjitendra 4 หลายเดือนก่อน +1

    Excellent!. Thank you so much Dave on this testing tutorial.

  • @johnpaulpineda2476
    @johnpaulpineda2476 ปีที่แล้ว +6

    Mah man on 208k subs??? You're growing too fast man you deserve all! last time i view your vids you're just on 70k subs.

    • @27sosite73
      @27sosite73 9 หลายเดือนก่อน

      263k!
      and he deserve many many many times more

  • @adeyemiadeyanju2247
    @adeyemiadeyanju2247 9 หลายเดือนก่อน

    Exactly this type of content but with Vitest. Great work and thank you

  • @yourcasualdeveloper
    @yourcasualdeveloper 11 หลายเดือนก่อน

    Here you are again... Another topic I discovered and another one you already covered.... thanks a lot

  • @Habib-oc5si3ng4v
    @Habib-oc5si3ng4v ปีที่แล้ว +1

    Hey Dave
    please explain about edge and node runtime in NextJs
    and please teach us NestJs.
    thank you
    I learned so much from you.

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

    brilliant explanation!

  • @maxpayne9074
    @maxpayne9074 11 หลายเดือนก่อน

    Hi Programmers. In folder ./lib fetch request's ( await fetch("/todos")). For working app need to use Route Handlers. Did I understand correctly?

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

    Hi I am using next js 13 app deployed on amplify aws but it gives me html chunks code after some time please tell me any solution.

  • @jora5483
    @jora5483 10 หลายเดือนก่อน

    Unfortunately, msw doesn't support request, carrying FormData and binary payload ...

  • @storozhukua
    @storozhukua 11 หลายเดือนก่อน

    when i run test i get err - TextEncoder is not defined

  • @Brian-vy5xp
    @Brian-vy5xp 8 หลายเดือนก่อน

    Only works for client fetch with msw

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

    Hi Dave, I've just started watching your web dev tutorials.
    Does your playlist named "full course programming " follows a specific sequence that aligns with web dev roadmap? Thanks for all the valuable content you provide! 👏

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

      Yes, and you can follow my Web Dev Roadmap at the link in the description of this video.

  • @7doors847
    @7doors847 ปีที่แล้ว

    Yay! My my my! 🙌

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

    Hi Dave 👋 How many more videos we can expect to complete this playlist? Approximately!!!

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

      I may give it a break for a bit and then come back with React & Vite and/or E2E with Cypress.

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

      @@DaveGrayTeachesCode that's a great news Dave ❤️ . We are so excited.

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

      @@DaveGrayTeachesCode Are you going to recreate full react playlist?

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

    thx

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

    Huh. msw 2.0 has been released

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

    at 10:32 you created a fetch. If I use fetch to real api should I create this fetch as fake or it should be request to real url?

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

      We are creating _mocks_ here for testing. You do this to eliminate outside dependencies.

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

      ​@@DaveGrayTeachesCode so I can't use a real api for testing? I can't put it to the handlers?
      So we simulate a fetching? In test I use real fetch and it works but it says "Warning: captured a request without a matching request handler" - if i use real api in handler it is breaking the test.

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

      @@yuliasereda5671 I promise you- if you don't understand what's happening in this code or WHY you're doing it, then you can just stop worrying about writing tests for now. Keep working on development and general JS skills first.

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

      @@sgtduckduck I understood almost everything, but I have never wrote tests before

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

    Are you planning to do a video about cypress?

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

    the best!

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

    Can I do this also with react?

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

    atlast 😅😅