Sfoglia il codice sorgente

✅ test(auth): 修复集成测试中认证请求的headers传递方式

- 调整hono/testing客户端的headers参数位置,确保认证头正确传递
- 修复me端点访问测试的请求格式,符合hono客户端API要求
yourname 2 mesi fa
parent
commit
3f0c021931
1 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. 7 4
      src/server/api/auth/__tests__/auth.integration.test.ts

+ 7 - 4
src/server/api/auth/__tests__/auth.integration.test.ts

@@ -318,11 +318,14 @@ describe('认证API集成测试 (使用hono/testing)', () => {
       const regularToken = authService.generateToken(regularUser);
 
       // 尝试访问需要认证的端点(这里使用/me端点)
-      const response = await client.auth.me.$get({
-        headers: {
-          'Authorization': `Bearer ${regularToken}`
+      const response = await client.auth.me.$get(
+        {},
+        {
+          headers: {
+            'Authorization': `Bearer ${regularToken}`
+          }
         }
-      });
+      );
 
       // 普通用户应该能够访问自己的信息
       expect(response.status).toBe(200);