[Testing Vue 3 apps] 1.11 - Mocking HTTP calls with Jest

Sdílet
Vložit
  • čas přidán 10. 10. 2020
  • My courses and advanced screencasts: vuejs-course.com/
    My website (sign-up for my book on Vue testing!) lachlan-miller.me/

Komentáře • 12

  • @tsioryanhykrishna9326
    @tsioryanhykrishna9326 Před 2 lety +1

    I love the way you use Vim :D clear and concise explanations ! Keep up the good works !

  • @isan-sunshine
    @isan-sunshine Před 3 lety +1

    This video is awesome! i learned alot! Thanks 😁

  • @mohammadkaab
    @mohammadkaab Před 2 lety

    Thanks for the video. :)

  • @tsioryanhykrishna9326
    @tsioryanhykrishna9326 Před 2 lety

    It would be nice if you make live stream when fixing some bugs on Vue.js !

    • @LachlanMiller
      @LachlanMiller  Před 2 lety

      Mmm maybe... never did a life stream before 🤔

  • @abrahamsa6464
    @abrahamsa6464 Před rokem

    Hello
    I have the next error in this section. Could you please help me?
    ReferenceError: jest is not defined
    const mockGet = jest.fn()
    | ^

    • @LachlanMiller
      @LachlanMiller  Před rokem +1

      Are you using Jest?

    • @abrahamsa6464
      @abrahamsa6464 Před rokem

      @@LachlanMiller Hello, i rework the solution and now im using Jest, but throw me this error this time :(
      SyntaxError: Cannot use import statement outside a module
      4 |
      5 |
      > 6 | import axios from 'axios'
      |^
      7 |
      8 | export default {
      9 | mounted() {

    • @LachlanMiller
      @LachlanMiller  Před rokem

      @@abrahamsa6464 I think you need babel-jest, that will help process ES modules in Jest.

  • @sandeepkapalawai1642
    @sandeepkapalawai1642 Před 2 lety

    @Lachlan Miller this was really a great tutoria love the way you teach in short and crisp, i have one questions as below
    I have 2 axios calls which are get , lets say methodA() as one axios and Method B() has another axios get request , i am getting an error when i try to mock below, incase of 2 get requests how do i need to do
    let fetchDeliveryPrograms = jest.fn();
    jest.mock('axios',()=>({
    get:() => fetchDeliveryPrograms()
    }));