- 初始化项目
- 添加登录注册功能

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/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();
+});