You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a test expects a mock function to have been called with a specific object, and the correct object is not received, the expected and received values are both shown as undefined. In the previous version of Storybook the delta between expected and received was displayed.
To Reproduce
import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
export const ClickButton: Story = {
args: { handleButtonClick: fn(), id: 1 },
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole("button"));
await waitFor(() =>
// NOTE: expecting the wrong id
expect(args.handleButtonClick).toHaveBeenCalledWith({ { id: 2 } }),
);
},
};
// NOTE: error seen in the interactions tab:
expect(spy).toHaveBeenCalledWith({ id: 1 } })
expected "spy" to be called with arguments: [ { id: 1 } ]
Expected: undefined
Received: undefined
See the full stack trace in the browser console.
Describe the bug
If a test expects a mock function to have been called with a specific object, and the correct object is not received, the expected and received values are both shown as undefined. In the previous version of Storybook the delta between expected and received was displayed.
To Reproduce
System
The text was updated successfully, but these errors were encountered: