- 初始化项目
- 添加登录注册功能
Change-Id: I4ceb5400dca3042f2f31232eaf246df83d57b9be
登录注册
Change-Id: Iee4aca2a0871ab46a95208ece13053e92b615b2e
init main page
Change-Id: I6c59617a37bbe71f115a43beb884c8596fb29c39
init main page, fix bug
Change-Id: I3eba8d45f017bbf303eb7462f305b5ca5661342f
首页
Change-Id: I7f6798780864af433b54f1c73721f631900d87f5
首页
Change-Id: I8368ab349bfa014ab306d0bf4bd4ced0e361cdd5
diff --git a/package-lock.json b/package-lock.json
index 4000cdd..f6885d7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,13 +8,15 @@
"name": "echo-frontend",
"version": "0.1.0",
"dependencies": {
+ "@icon-park/react": "^1.4.2",
"@testing-library/dom": "^10.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.5.0",
"react-scripts": "5.0.1",
- "web-vitals": "^2.1.4"
+ "web-vitals": "^2.1.4",
+ "wouter": "^3.6.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.6.3",
@@ -2497,6 +2499,20 @@
"deprecated": "Use @eslint/object-schema instead",
"license": "BSD-3-Clause"
},
+ "node_modules/@icon-park/react": {
+ "version": "1.4.2",
+ "resolved": "https://registry.npmmirror.com/@icon-park/react/-/react-1.4.2.tgz",
+ "integrity": "sha512-+MtQLjNiRuia3fC/NfpSCTIy5KH5b+NkMB9zYd7p3R4aAIK61AjK0OSraaICJdkKooU9jpzk8m0fY4g9A3JqhQ==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">= 8.0.0",
+ "npm": ">= 5.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=16.9",
+ "react-dom": ">=16.9"
+ }
+ },
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
"resolved": "https://registry.npmmirror.com/@isaacs/cliui/-/cliui-8.0.2.tgz",
@@ -11486,6 +11502,12 @@
"node": ">=16 || 14 >=14.17"
}
},
+ "node_modules/mitt": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz",
+ "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
+ "license": "MIT"
+ },
"node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmmirror.com/mkdirp/-/mkdirp-0.5.6.tgz",
@@ -14207,6 +14229,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/regexparam": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmmirror.com/regexparam/-/regexparam-3.0.0.tgz",
+ "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/regexpu-core": {
"version": "6.2.0",
"resolved": "https://registry.npmmirror.com/regexpu-core/-/regexpu-core-6.2.0.tgz",
@@ -16607,6 +16638,15 @@
"requires-port": "^1.0.0"
}
},
+ "node_modules/use-sync-external-store": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmmirror.com/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz",
+ "integrity": "sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz",
@@ -17469,6 +17509,20 @@
"workbox-core": "6.6.0"
}
},
+ "node_modules/wouter": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmmirror.com/wouter/-/wouter-3.6.0.tgz",
+ "integrity": "sha512-l11eR4urCc+CbY8+pV8HKFHxEqMgffss9aVB1XwiSkLDtH3cI6XpCa50cOzREzL0KwQqrwCVE5dCyeNcCgFpPg==",
+ "license": "Unlicense",
+ "dependencies": {
+ "mitt": "^3.0.1",
+ "regexparam": "^3.0.0",
+ "use-sync-external-store": "^1.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.0"
+ }
+ },
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
diff --git a/package.json b/package.json
index 42e4b7f..d73600f 100644
--- a/package.json
+++ b/package.json
@@ -3,13 +3,15 @@
"version": "0.1.0",
"private": true,
"dependencies": {
+ "@icon-park/react": "^1.4.2",
"@testing-library/dom": "^10.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.5.0",
"react-scripts": "5.0.1",
- "web-vitals": "^2.1.4"
+ "web-vitals": "^2.1.4",
+ "wouter": "^3.6.0"
},
"scripts": {
"start": "react-scripts start",
@@ -38,5 +40,10 @@
"devDependencies": {
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0"
+ },
+ "jest": {
+ "transformIgnorePatterns": [
+ "/node_modules/(?!wouter)"
+ ]
}
}
diff --git a/src/App.js b/src/App.js
index 50fb6da..ce08b7b 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,23 +1,19 @@
-import Navbar from './components/Navbar';
-import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
-import AuthPage from './pages/AuthPage';
+import { Route, Switch } from 'wouter'; // Import from wouter
+import AuthPage from './pages/AuthPage/AuthPage';
import HomePage from './pages/HomePage';
-import ForumPage from './pages/ForumPage';
+import MainPage from './pages/MainPage/MainPage';
import { UserProvider } from './context/UserContext';
function App() {
return (
<UserProvider>
- <Router>
- <Navbar />
- <Routes>
- <Route path="/" element={<HomePage />} />
- <Route path="/auth" element={<AuthPage />} />
- <Route path="/forum" element={<ForumPage />} />
- </Routes>
- </Router>
+ <Switch>
+ <Route path="/" component={HomePage} />
+ <Route path="/auth" component={AuthPage} />
+ <Route path="/main-page" component={MainPage} />
+ </Switch>
</UserProvider>
);
}
-export default App;
\ No newline at end of file
+export default App;
diff --git a/src/App.test.js.text b/src/App.test.js.text
new file mode 100644
index 0000000..178656c
--- /dev/null
+++ b/src/App.test.js.text
@@ -0,0 +1,13 @@
+import { render, screen } from '@testing-library/react';
+import { Router } from 'wouter'; // Use Router from wouter
+import App from './App';
+
+test('renders learn react link', () => {
+ render(
+ <Router>
+ <App />
+ </Router>
+ );
+ const linkElement = screen.getByText(/learn react/i);
+ expect(linkElement).toBeInTheDocument();
+});
diff --git a/src/App.test.js.txt b/src/App.test.js.txt
deleted file mode 100644
index 0e79337..0000000
--- a/src/App.test.js.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-// import { render, screen } from '@testing-library/react';
-// import { BrowserRouter } from 'react-router-dom';
-// import App from './App';
-
-
-// test('renders learn react link', () => {
-// render(
-// <BrowserRouter>
-// <App />
-// </BrowserRouter>
-// );
-// const linkElement = screen.getByText(/learn react/i);
-// expect(linkElement).toBeInTheDocument();
-// });
diff --git a/src/components/Auth/Login.jsx b/src/components/Auth/Login.jsx
index e7495b5..2f43619 100644
--- a/src/components/Auth/Login.jsx
+++ b/src/components/Auth/Login.jsx
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import './Auth.css';
+import '../../pages/AuthPage/AuthPage.css';
import image from './logo.svg'; // 引入图片
const Login = ({ onRegisterClick }) => {
const [formData, setFormData] = useState({
diff --git a/src/components/Auth/Register.jsx b/src/components/Auth/Register.jsx
index 417864f..de32cc2 100644
--- a/src/components/Auth/Register.jsx
+++ b/src/components/Auth/Register.jsx
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import './Auth.css';
+import '../../pages/AuthPage/AuthPage.css';
import image from './logo.svg'; // 引入图片
const Register = ({ onLoginClick }) => {
diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx
index eed15ec..6986206 100644
--- a/src/components/Navbar.jsx
+++ b/src/components/Navbar.jsx
@@ -1,30 +1,29 @@
-import React from 'react';
-import { useUser } from '../context/UserContext';
-import { Link } from 'react-router-dom';
+// import React from 'react';
+// import { Link } from 'wouter'; // Use wouter's Link component
-const Navbar = () => {
- const { user, logout } = useUser();
+// const Navbar = () => {
+// const { user, logout } = useUser();
- return (
- <nav className="navbar">
- <div className="logo">EchoTorrent</div>
- <div className="nav-links">
- {user ? (
- <>
- <Link to="/">主页</Link>
- <Link to="/profile">个人中心</Link>
- <Link to="/forum">论坛</Link>
- <button onClick={logout}>退出登录</button>
- </>
- ) : (
- <>
- <Link to="/auth">登录/注册</Link>
- <Link to="/forum">论坛</Link>
- </>
- )}
- </div>
- </nav>
- );
-};
+// return (
+// <nav className="navbar">
+// <div className="logo">EchoTorrent</div>
+// <div className="nav-links">
+// {user ? (
+// <>
+// <Link to="/">主页</Link>
+// <Link to="/profile">个人中心</Link>
+// <Link to="/forum">论坛</Link>
+// <button onClick={logout}>退出登录</button>
+// </>
+// ) : (
+// <>
+// <Link to="/auth">登录/注册</Link>
+// <Link to="/forum">论坛</Link>
+// </>
+// )}
+// </div>
+// </nav>
+// );
+// };
-export default Navbar;
\ No newline at end of file
+// export default Navbar;
diff --git a/src/logo.svg b/src/logo.svg
index 38d62ff..7772be2 100644
--- a/src/logo.svg
+++ b/src/logo.svg
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
<svg width="81" height="81" viewBox="0 0 81 81" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M40.5 6.74951V74.2496" stroke="#FBF2E3" stroke-width="4" stroke-linecap="round"/>
<path d="M57.375 20.2498V60.7498" stroke="#FBF2E3" stroke-width="4" stroke-linecap="round"/>
@@ -22,3 +23,6 @@
</clipPath>
</defs>
</svg>
+=======
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
+>>>>>>> d820d18 (- 初始化项目)
diff --git a/src/components/Auth/Auth.css b/src/pages/AuthPage/AuthPage.css
similarity index 100%
rename from src/components/Auth/Auth.css
rename to src/pages/AuthPage/AuthPage.css
diff --git a/src/pages/AuthPage.jsx b/src/pages/AuthPage/AuthPage.jsx
similarity index 77%
rename from src/pages/AuthPage.jsx
rename to src/pages/AuthPage/AuthPage.jsx
index e5effe1..4238214 100644
--- a/src/pages/AuthPage.jsx
+++ b/src/pages/AuthPage/AuthPage.jsx
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
-import Login from '../components/Auth/Login';
-import Register from '../components/Auth/Register';
+import Login from '../../components/Auth/Login';
+import Register from '../../components/Auth/Register';
const AuthPage = () => {
const [isRegister, setIsRegister] = useState(false);
diff --git a/src/pages/AuthPage.test.jsx b/src/pages/AuthPage/AuthPage.test.jsx
similarity index 100%
rename from src/pages/AuthPage.test.jsx
rename to src/pages/AuthPage/AuthPage.test.jsx
diff --git a/src/pages/MainPage/MainPage.css b/src/pages/MainPage/MainPage.css
new file mode 100644
index 0000000..60f2956
--- /dev/null
+++ b/src/pages/MainPage/MainPage.css
@@ -0,0 +1,88 @@
+.main-page {
+ background-color: #5c3f31;
+ color: white;
+ }
+ .header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px;
+ }
+ .logo-and-name {
+ display: flex;
+ align-items: center;
+ }
+ .logo {
+ height: 30px;
+ margin-right: 10px;
+ }
+ .site-name {
+ font-size: 24px;
+ }
+ .user-and-message {
+ display: flex;
+ align-items: center;
+ }
+ .user-avatar {
+ height: 40px;
+ margin-right: 10px;
+ }
+ .message-center {
+ font-size: 16px;
+ }
+ .nav {
+ background-color: #b38867;
+ display: flex;
+ justify-content: center;
+ }
+ .nav-item {
+ color: white;
+ text-decoration: none;
+ padding: 10px 20px;
+ }
+ .active {
+ background-color: #996633;
+ }
+ .content {
+ padding: 20px;
+ }
+ .user-post {
+ border-bottom: 1px solid white;
+ margin-bottom: 20px;
+ padding-bottom: 20px;
+ }
+ .user-info {
+ display: flex;
+ align-items: center;
+ margin-bottom: 10px;
+ }
+ .user-avatar-small {
+ height: 30px;
+ margin-right: 10px;
+ }
+ .username {
+ font-size: 16px;
+ }
+ .post-content {
+ margin-bottom: 10px;
+ }
+ .post-actions {
+ display: flex;
+ align-items: center;
+ margin-bottom: 10px;
+ }
+ .like-icon,
+ .comment-icon {
+ margin-right: 5px;
+ }
+ .like-count,
+ .comment-count {
+ margin-left: 5px;
+ }
+ .post-image {
+ float: right;
+ width: 150px;
+ height: 150px;
+ background-color: #ddd;
+ margin-left: 10px;
+ }
\ No newline at end of file
diff --git a/src/pages/MainPage/MainPage.jsx b/src/pages/MainPage/MainPage.jsx
new file mode 100644
index 0000000..1dad401
--- /dev/null
+++ b/src/pages/MainPage/MainPage.jsx
@@ -0,0 +1,55 @@
+import React from 'react';
+import './MainPage.css'; // 可创建对应样式文件来完善样式
+import { Link } from 'wouter'; // Use wouter's Link component
+// import '@icon-park/react/styles/index.css';
+// import { GoodTwo, Comment } from '@icon-park/react';
+
+const MainPage = () => {
+ return (
+ <div className="main-page">
+ {/* 顶部栏 */}
+ <header className="header">
+ {/* 左侧logo和网站名称 */}
+ <div className="logo-and-name">
+ <img src="logo.png" alt="网站logo" className="logo" />
+ <span className="site-name">Echo</span>
+ </div>
+ {/* 右侧用户头像和消息中心 */}
+ <div className="user-and-message">
+ <img src="user-avatar.png" alt="用户头像" className="user-avatar" />
+ <span className="message-center">消息</span>
+ </div>
+ </header>
+ {/* 导航栏 */}
+ <nav className="nav">
+ <Link to="/friend-moments" className="nav-item active">好友动态</Link>
+ <Link to="/forum" className="nav-item">论坛</Link>
+ <Link to="/interest-groups" className="nav-item">兴趣小组</Link>
+ <Link to="/seed-list" className="nav-item">种子列表</Link>
+ <Link to="/publish-seed" className="nav-item">发布种子</Link>
+ </nav>
+ {/* 好友动态内容区域 */}
+ <div className="content">
+ {/* 用户动态示例,可从后端获取数据循环展示 */}
+ <div className="user-post">
+ <div className="user-info">
+ <img src="user1-avatar.png" alt="用户头像" className="user-avatar-small" />
+ <span className="username">user1</span>
+ </div>
+ <div className="post-content">
+ <p>动态内容...</p>
+ </div>
+ <div className="post-actions">
+ {/* <GoodTwo theme="outline" size="24" fill="#fff" /> */}
+ <span className="like-count">21</span>
+ {/* <Comment theme="outline" size="24" fill="#fff"/> */}
+ <span className="comment-count">2</span>
+ </div>
+ <img src="image1.png" alt="动态图片" className="post-image" />
+ </div>
+ </div>
+ </div>
+ );
+};
+
+export default MainPage;
diff --git a/src/pages/MainPage/MainPage.test.js b/src/pages/MainPage/MainPage.test.js
new file mode 100644
index 0000000..651f9c6
--- /dev/null
+++ b/src/pages/MainPage/MainPage.test.js
@@ -0,0 +1,42 @@
+import { render, screen } from '@testing-library/react';
+import { Router } from 'wouter'; // 使用 wouter 的 Router
+import MainPage from './MainPage'; // 导入 MainPage 组件
+
+test('renders MainPage with logo, navigation links, and user post', () => {
+ render(
+ <Router>
+ <MainPage />
+ </Router>
+ );
+
+ // 检查页面中是否有 Echo 站点名称
+ const siteNameElement = screen.getByText(/Echo/i);
+ expect(siteNameElement).toBeInTheDocument();
+
+ // 检查页面中是否有导航栏中的链接
+ const friendMomentsLink = screen.getByText(/好友动态/i);
+ const forumLink = screen.getByText(/论坛/i);
+ const interestGroupsLink = screen.getByText(/兴趣小组/i);
+ const seedListLink = screen.getByText(/种子列表/i);
+ const publishSeedLink = screen.getByText(/发布种子/i);
+
+ expect(friendMomentsLink).toBeInTheDocument();
+ expect(forumLink).toBeInTheDocument();
+ expect(interestGroupsLink).toBeInTheDocument();
+ expect(seedListLink).toBeInTheDocument();
+ expect(publishSeedLink).toBeInTheDocument();
+
+ // 检查页面中是否有用户动态信息
+ const usernameElement = screen.getByText(/user1/i);
+ expect(usernameElement).toBeInTheDocument();
+
+ const postContentElement = screen.getByText(/动态内容.../i);
+ expect(postContentElement).toBeInTheDocument();
+
+ // 使用更精确的查询来获取喜欢数和评论数
+ const likeCountElement = screen.getByText('21');
+ const commentCountElement = screen.getByText('2');
+
+ expect(likeCountElement).toBeInTheDocument();
+ expect(commentCountElement).toBeInTheDocument();
+});