| 22301014 | 62240ab | 2025-06-07 09:28:16 +0800 | [diff] [blame^] | 1 | import { render, screen } from '@testing-library/react' |
| 2 | import Register from '../../feature/auth/Register' |
| 3 | import { Provider } from 'react-redux' |
| 4 | import { store } from '../../store/store' |
| 5 | import { MemoryRouter } from 'react-router' |
| 6 | |
| 7 | describe('Register Page', () => { |
| 8 | it('renders register form', () => { |
| 9 | render( |
| 10 | <MemoryRouter> |
| 11 | <Provider store={store}> |
| 12 | <Register /> |
| 13 | </Provider> |
| 14 | </MemoryRouter> |
| 15 | |
| 16 | ) |
| 17 | |
| 18 | const nameInput = screen.getByPlaceholderText('请输入用户名') |
| 19 | const emailInput = screen.getByPlaceholderText('请输入邮箱') |
| 20 | const verifyCodeInput = screen.getByPlaceholderText('请输入验证码') |
| 21 | const passwordInput = screen.getByPlaceholderText('请输入密码') |
| 22 | const confirmPasswordInput = screen.getByPlaceholderText('请确认密码') |
| 23 | const registerButton = screen.getByText('注册') |
| 24 | |
| 25 | expect(nameInput).toBeInTheDocument() |
| 26 | expect(emailInput).toBeInTheDocument() |
| 27 | expect(verifyCodeInput).toBeInTheDocument() |
| 28 | expect(passwordInput).toBeInTheDocument() |
| 29 | expect(confirmPasswordInput).toBeInTheDocument() |
| 30 | expect(registerButton).toBeInTheDocument() |
| 31 | }) |
| 32 | }) |