Skip to content

QRL/function props spies in interaction tests #79

@k-schneider

Description

@k-schneider

If I have a button with a simple onClick$ handler, how might I go about asserting that the QRL was invoked?

The storybook docs recommend you use fn() which returns a spy so in React your test can simply use expect(args.onClick).toHaveBeenCalled(); to verify.

With Qwik, you need to pass QRL's so how can you verify they're invoked? I tried wrapping a spy into a QRL and then asserting the underlying spy was invoked but it never is (assuming that serialization breaks this somehow?).

Is this possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions