```ts // NoteUI.stories.ts import { expect, userEvent, within } from '@storybook/test'; import { saveNote } from '#app/actions.mock'; import { createNotes } from '#mocks/notes'; export default { title: 'Mocked/NoteUI', component: 'note-ui', }; const notes = createNotes(); export const SaveFlow = { name: 'Save Flow ▶', args: { isEditing: true, note: notes[0], }, play: async ({ canvasElement, step }) => { const canvas = within(canvasElement); const saveButton = canvas.getByRole('menuitem', { name: /done/i }); await userEvent.click(saveButton); // 👇 This is the mock function, so you can assert its behavior await expect(saveNote).toHaveBeenCalled(); }, }; ```