-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[test(auth)]: Add unit tests for useSignInUpForm hook #9648
Conversation
Introduce unit tests to validate the behavior of the useSignInUpForm hook. Tests cover default initialization, handling of developer defaults, and prefilled values based on state.
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.
PR Summary
Added comprehensive unit tests for the useSignInUpForm hook, validating form initialization and state-dependent prefill behavior in the authentication flow.
- Added test cases in
/packages/twenty-front/src/modules/auth/sign-in-up/hooks/__tests__/useSignInUpForm.test.tsx
for form initialization and developer default prefilling - Tests verify correct handling of URL email parameters and developer prefill state
- Hardcoded password 'Applecar2025' in tests should be moved to a test constants file
- Commented-out test case for prefilled email functionality should be implemented
- Missing test coverage for password validation using PASSWORD_REGEX
1 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
</MemoryRouter> | ||
), | ||
}); | ||
expect(result.current.form).toBeDefined(); |
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.
logic: This assertion only checks if form exists. Should verify the actual default values.
// it('should set prefilled email if available', () => { | ||
// renderHook(() => useSignInUpForm()); | ||
// expect(mockSetValue).toHaveBeenCalledWith('email', mockPrefilledEmail); | ||
// }); |
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.
style: Incomplete test case left commented out. Either implement or remove.
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should initialize the form with default values', async () => { |
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.
logic: Test is marked async but doesn't use any await statements
Introduce unit tests to validate the behavior of the useSignInUpForm hook. Tests cover default initialization, handling of developer defaults, and prefilled values based on state.
Log
|
Introduce unit tests to validate the behavior of the useSignInUpForm hook. Tests cover default initialization, handling of developer defaults, and prefilled values based on state.
Introduce unit tests to validate the behavior of the useSignInUpForm hook. Tests cover default initialization, handling of developer defaults, and prefilled values based on state.