JavaScript Testing with Jest - Crash Course

Поділитися
Вставка
  • Опубліковано 6 сер 2024
  • Learn how to test JavaScript code using the Jest testing framework. Jest is a JavaScript testing framework designed to ensure correctness of any JavaScript codebase. It allows you to write tests with an approachable, familiar and feature-rich API that gives you results quickly.
    ✏️ Course developed by ‪@CodeWithTomi‬
    ⭐️ Contents ⭐️
    00:00 Intro
    00:45 Setting Up Jest
    06:22 Basic Concepts In Jest
    15:31 Matchers
    33:21 Testing Asynchronous Code
    49:48 Mock Functions and Spies
    1:00:20 Outro
    🎉 Thanks to our Champion and Sponsor supporters:
    👾 davthecoder
    👾 jedi-or-sith
    👾 南宮千影
    👾 Agustín Kussrow
    👾 Nattira Maneerat
    👾 Heather Wcislo
    👾 Serhiy Kalinets
    👾 Justin Hual
    👾 Otis Morgan
    👾 Oscar Rahnama
    --
    Learn to code for free and get a developer job: www.freecodecamp.org
    Read hundreds of articles on programming: freecodecamp.org/news

КОМЕНТАРІ • 44

  • @0xVantwoutMaarten
    @0xVantwoutMaarten Місяць тому +3

    Everything is clear,so well done, but for my taste way to easy and basic, could have gone much more in-depth for most devs. Including class mocking, actual mocking use cases, snapshots, setup /teardown, scoping, coverage, many more things I would like to see, but maybe in Part 2!

  • @mamadmehdiazizi9401
    @mamadmehdiazizi9401 3 дні тому

    so simple tutorial about jest . please release more parts about this topic

  • @devworks8787
    @devworks8787 7 місяців тому +3

    much needed one. please add other testing libraries as well especially ones for react

  • @M7ilan
    @M7ilan 7 місяців тому +5

    Wow day ago thought it was years ago. Perfect timing for me I guess

  • @ankitrawat7211
    @ankitrawat7211 7 місяців тому

    Woww!!! This is exactly what I wanted

  • @M7ilan
    @M7ilan 7 місяців тому +3

    This man offer very good explanation. Good job!

  • @ryanwoods3333
    @ryanwoods3333 7 місяців тому +3

    great! how about more in-depth and with React?

  • @salimonwale374
    @salimonwale374 7 місяців тому +1

    Great video and lecture. I have been able to link my replit account with my github but I have been unable to link or upload the files of my repositories from replit to github. It's only showing my repositories on github but it's empty. How do I upload the files?

  • @juanmacias5922
    @juanmacias5922 7 місяців тому +4

    46:20
    function fetchPromise(isComplete) {
    return new Promise((resolve, reject) => {
    if (isComplete) {
    setTimeout(() => resolve('Hi'), 1000)
    }
    else {
    setTimeout(() => reject(new Error('error')), 1000)
    }
    })
    }
    test("fetchPromise is 'Hi'", () => {
    return expect(fetchPromise(true)).resolves.toBe("Hi")
    })
    test("fetchPromise throws", () => {
    return expect(fetchPromise(false)).rejects.toThrow("error")
    })

  • @engineeringmadeasy
    @engineeringmadeasy 7 місяців тому +2

    At 7:28. Line 7, dont we need to replace ( "echo \"Error: no test specified\" && exit 1") with ( "jest" ). Instead of "test" with "jest"?? Can someone please clarify. Thanks

    • @mitchell4217
      @mitchell4217 7 місяців тому +2

      Jump to 13:36. He clarifies here. I think he put this part in here to show that you have to update the value, or the right-hand side of the key: value pair.

  • @Franck_Polla
    @Franck_Polla 7 місяців тому

    thank you

  • @filippotinnirello
    @filippotinnirello 7 місяців тому +1

    Got lost around 39:00, why there's a "callback" function inside fetchData? Why the test calls a function (fetchData) of a function (callback)?

    • @djdennyjohn
      @djdennyjohn 7 місяців тому +1

      The callback function is a placeholder for any function that will be passed as an argument when calling fetchData. This pattern is common in asynchronous programming, where you provide a function to be executed once an asynchronous operation (in this case, the timeout) is complete.

  • @khalidelgazzar
    @khalidelgazzar 7 місяців тому

    Beautiful 😊

  • @dylanheslop9161
    @dylanheslop9161 7 місяців тому

    I was actually looking for testing react applications... I think the last video you guys uploaded was about a year ago... would like a new updated one

  • @haciendadad
    @haciendadad 4 місяці тому

    Nice tutorial, but I wish there could have used a more complex example other than that sum function. Still a good video!

  • @olakunlemuheeb6229
    @olakunlemuheeb6229 7 місяців тому +9

    Naija to the world 🎉🎉

  • @JonathanKila
    @JonathanKila 4 місяці тому

    Does anyone know why intellisense does not work?

  • @ankitasood8589
    @ankitasood8589 Місяць тому

    Can we not add two import in same file say i want to import sum and myFunction both, on executing this i am getting an error saying module not found ?

  • @nested9301
    @nested9301 7 місяців тому

    tf i was about to search jest and this video pops up loool

  • @akashojha4127
    @akashojha4127 7 місяців тому +1

    First' view on this course ❤❤

  • @drekcari
    @drekcari 4 місяці тому

    Is this applicable to typescript?

  • @ShoxaKardashian
    @ShoxaKardashian 6 місяців тому +1

    What the theme is used in your VSCode?

  • @rupeshgade4804
    @rupeshgade4804 7 місяців тому

    ❤❤❤

  • @rishiraj2548
    @rishiraj2548 7 місяців тому +1

    🙏🙂👍

  • @moutasim_ayoubi
    @moutasim_ayoubi 7 місяців тому

    JIT video

  • @nzubeprecious2914
    @nzubeprecious2914 7 місяців тому +2

    Wow Nigeria to the World

  • @david-dong
    @david-dong 7 місяців тому +31

    Thank you LeBron James

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

      What theme does he use?

  • @juanmacias5922
    @juanmacias5922 7 місяців тому +2

    2:22 could have just ran "code ." from the terminal to open up VsCode :D

  • @Ham.AI.
    @Ham.AI. 7 місяців тому

    ferst

  • @AkashRaj-zc6vc
    @AkashRaj-zc6vc 5 місяців тому

    Not much help because instructor himself is not confident could have been better specially the async part.

  • @DukeChameleon
    @DukeChameleon 4 місяці тому +1

    I like how online courses are starting to cover indian guys giving the lecture by presenting the white guy first

    • @dbrandeau
      @dbrandeau 4 місяці тому +2

      He does not look nor sound Indian.

  • @MdAJIMKhan-qc3cy
    @MdAJIMKhan-qc3cy 7 місяців тому

    সুবাহানাল্লাহিল আজিম সুবহানাল্লাহি ওয়াবি হামদিহি আস্তাগফিরুল্লাহ

  • @helleyequeue
    @helleyequeue 7 місяців тому

    Can we move away from JS already? It’s getting toxic these days.