-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(react): remove any in test cases #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🚀 Preview deploymentBranch: 📝 Preview URL: https://auth0-universal-components-7g9p702ia-okta.vercel.app Updated at 2025-12-19T05:47:20.494Z |
| const mockMyOrganizationClient = mockCoreClient.getMyOrganizationApiClient(); | ||
| mockMyOrganizationClient.organization.configuration.get = mockGet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not entirely sure this override is necessary, as we aren't providing a specific response during the mock phase. Could you please double check if this is required?
| const createCustomMockTranslator = (): ReturnType< | ||
| typeof useTranslatorModule.useTranslator | ||
| >['t'] => { | ||
| const translatorFn = vi.fn((key: string, params?: Record<string, unknown>) => { | ||
| if (key === 'general_error') return 'An error occurred'; | ||
| if (key === 'update_success') return `Updated ${params?.providerName || ''}`; | ||
| if (key === 'delete_success') return `Deleted ${params?.providerName || ''}`; | ||
| if (key === 'remove_success') | ||
| return `Removed ${params?.providerName || ''} from ${params?.organizationName || ''}`; | ||
| return key; | ||
| }); | ||
|
|
||
| // Add trans method for EnhancedTranslationFunction compatibility | ||
| const translator = Object.assign(translatorFn, { | ||
| trans: vi.fn(() => []), | ||
| }); | ||
|
|
||
| return translator as ReturnType<typeof useTranslatorModule.useTranslator>['t']; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we try to use the existing mock translator test utility createMockI18nService?
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Remove any casting in test cases and add correct types
References
https://auth0.slack.com/archives/C09DNSP8U0Z/p1766047059411379
Testing
All Tests should pass
Checklist