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
expect(wrapper.vm.count).toBe(0);
//click btn in Counter (child component)
wrapper.find("#incrementBtn").trigger("click");
//check if increment worked and count has increased
expect(wrapper.vm.count).toBe(1);
});
Learning curve to think in “Jest” 🙂
CLICK HERE to find out more related problems solutions.