How to test Vue prop update in Jest

Okay, I finally found a solution! I went the wrong way about things and tried to test parent data changes in a child component. With the composition I have (child component Counter emits an event and triggers a change in parent Home component), this is the working test:

  it("Counter button changes count in Home", () => {
    const wrapper = mountFactory(Home);

    //check if initial count in Home is 0

    //click btn in Counter (child component)

    //check if increment worked and count has increased

Learning curve to think in “Jest” 🙂

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top