|
|
@@ -88,11 +88,11 @@ describe('认证API集成测试 (使用hono/testing)', () => {
|
|
|
json: loginData
|
|
|
});
|
|
|
|
|
|
- // 根据实际实现,认证失败可能返回500而不是401
|
|
|
- expect([401, 500]).toContain(response.status);
|
|
|
- if (response.status === 500) {
|
|
|
+ // 认证失败应该返回401
|
|
|
+ expect(response.status).toBe(401);
|
|
|
+ if (response.status === 401){
|
|
|
const responseData = await response.json();
|
|
|
- expect(responseData.message).toContain('Invalid password');
|
|
|
+ expect(responseData.message).toContain('用户名或密码错误');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -106,11 +106,11 @@ describe('认证API集成测试 (使用hono/testing)', () => {
|
|
|
json: loginData
|
|
|
});
|
|
|
|
|
|
- // 根据实际实现,认证失败可能返回500而不是401
|
|
|
- expect([401, 500]).toContain(response.status);
|
|
|
- if (response.status === 500) {
|
|
|
+ // 认证失败应该返回401
|
|
|
+ expect(response.status).toBe(401);
|
|
|
+ if (response.status === 401){
|
|
|
const responseData = await response.json();
|
|
|
- expect(responseData.message).toContain('User not found');
|
|
|
+ expect(responseData.message).toContain('用户名或密码错误');
|
|
|
}
|
|
|
});
|
|
|
|