blob: c118a8bed74225651d0de4b084bb5aaae731425d [file] [log] [blame]
2230101462240ab2025-06-07 09:28:16 +08001import { render, screen } from '@testing-library/react'
2import Register from '../../feature/auth/Register'
3import { Provider } from 'react-redux'
4import { store } from '../../store/store'
5import { MemoryRouter } from 'react-router'
6
7describe('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})