| 22301014 | 62240ab | 2025-06-07 09:28:16 +0800 | [diff] [blame] | 1 | import { render, screen } from '@testing-library/react' |
| 2 | import Login from '../../feature/auth/Login' |
| 3 | import { Provider } from 'react-redux' |
| 4 | import { store } from '../../store/store' |
| 5 | import { MemoryRouter } from 'react-router' |
| 6 | |
| 7 | describe('Login Page', () => { |
| 8 | it('renders login form', () => { |
| 9 | render( |
| 10 | <MemoryRouter> |
| 11 | <Provider store={store}> |
| 12 | <Login /> |
| 13 | </Provider> |
| 14 | </MemoryRouter> |
| 15 | |
| 16 | ) |
| 17 | |
| 18 | const emailInput = screen.getByPlaceholderText('账号(注册邮箱)') |
| 19 | const passwordInput = screen.getByPlaceholderText('密码') |
| 20 | const loginButton = screen.getByRole('button', { name: /登录/i }) |
| 21 | |
| 22 | |
| 23 | expect(emailInput).toBeInTheDocument() |
| 24 | expect(passwordInput).toBeInTheDocument() |
| 25 | expect(loginButton).toBeInTheDocument() |
| 26 | }) |
| 27 | }) |