Skip to content

Spying on methods when using the composition api #775

Closed
@maurer2

Description

@maurer2

Hello, it seems that when using the options api, it is recommended to create spies for methods before mounting to avoid issues with event handlers that don't have braces (example 1, example 2, example 3).
How would one do the same with the composition api? The following doesn't work, as methods isn't available/exposed when using the composition api?

const spy = jest.spyOn(ComponentName.methods, 'methodName');
// mount stuff
expect(spy).toHaveBeenCalled()

Thanks

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions