Skip to content

How to stub methods called inside mount hook #148

@kleinjm

Description

@kleinjm

I'm running into an issue where I can't mock the method called in my mounted() hook and I'm assuming it has to do with the load order.

const myMethod = sinon.stub();
wrapper.setMethods({ myMethod });

I've also tried

    const myMethod = sinon.spy();

    wrapper = mount(ProfileSidebarIndex, {
      methods: { myMethod },
    });

and mocking mounted itself

    const mounted = sinon.stub();

    wrapper = mount(ProfileSidebarIndex, {
      mounted
    });

Is there a way to do this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions