storybook-framework-qwik icon indicating copy to clipboard operation
storybook-framework-qwik copied to clipboard

QRL/function props spies in interaction tests

Open k-schneider opened this issue 11 months ago • 1 comments

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?

k-schneider avatar Nov 21 '24 14:11 k-schneider