fix(storybook): fix page delete account storybook#20424
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the broken PageDeleteAccount Storybook stories by providing the required AppContext.Provider and adding a second variant to cover passwordless accounts.
Changes:
- Wrapes
PageDeleteAccountstories withAppContext.ProviderusingmockAppContext()so required context (e.g.,authClient) is present. - Adds two story variants: one for accounts with a password and one without a password.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| destroy: () => Promise.resolve(), | ||
| } as unknown as Account; | ||
|
|
||
| const accountWithoutPassword = { | ||
| ...MOCK_ACCOUNT, | ||
| hasPassword: false, | ||
| destroy: () => Promise.resolve(), |
There was a problem hiding this comment.
Account.destroy takes a password: string argument (see models/Account.ts), but this story’s mock destroy stub is declared with no parameters. Even though extra args are ignored at runtime, matching the real signature here makes the mock intent clearer and avoids confusion when the component passes the password/empty string.
| destroy: () => Promise.resolve(), | |
| } as unknown as Account; | |
| const accountWithoutPassword = { | |
| ...MOCK_ACCOUNT, | |
| hasPassword: false, | |
| destroy: () => Promise.resolve(), | |
| destroy: (_password: string) => Promise.resolve(), | |
| } as unknown as Account; | |
| const accountWithoutPassword = { | |
| ...MOCK_ACCOUNT, | |
| hasPassword: false, | |
| destroy: (_password: string) => Promise.resolve(), |
| destroy: () => Promise.resolve(), | ||
| } as unknown as Account; | ||
|
|
||
| const accountWithoutPassword = { | ||
| ...MOCK_ACCOUNT, | ||
| hasPassword: false, | ||
| destroy: () => Promise.resolve(), |
There was a problem hiding this comment.
Same as above: consider updating this mock destroy to accept a password: string parameter to mirror the real Account.destroy(password) API used by PageDeleteAccount.
| destroy: () => Promise.resolve(), | |
| } as unknown as Account; | |
| const accountWithoutPassword = { | |
| ...MOCK_ACCOUNT, | |
| hasPassword: false, | |
| destroy: () => Promise.resolve(), | |
| destroy: (_password: string) => Promise.resolve(), | |
| } as unknown as Account; | |
| const accountWithoutPassword = { | |
| ...MOCK_ACCOUNT, | |
| hasPassword: false, | |
| destroy: (_password: string) => Promise.resolve(), |
Because
This pull request
defaultandpasswordlessaccountsIssue that this pull request solves
Closes: (issue number)
Checklist
Put an
xin the boxes that applyHow to review (Optional)
Screenshots (Optional)
Other information (Optional)
Any other information that is important to this pull request.