|
@@ -1,5 +1,4 @@
|
|
|
import { UserService } from '../user.service';
|
|
import { UserService } from '../user.service';
|
|
|
-import { DataSource } from 'typeorm';
|
|
|
|
|
import { UserEntity as User } from '../user.entity';
|
|
import { UserEntity as User } from '../user.entity';
|
|
|
import * as bcrypt from 'bcrypt';
|
|
import * as bcrypt from 'bcrypt';
|
|
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
@@ -181,7 +180,7 @@ describe('UserService', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
it('应该验证密码错误', async () => {
|
|
it('应该验证密码错误', async () => {
|
|
|
- vi.mocked(bcrypt.compare).mockResolvedValueOnce(false);
|
|
|
|
|
|
|
+ (vi.mocked(bcrypt.compare) as any).mockResolvedValueOnce(false);
|
|
|
const user = { password: 'hashed_password' } as User;
|
|
const user = { password: 'hashed_password' } as User;
|
|
|
|
|
|
|
|
const result = await userService.verifyPassword(user, 'wrong_password');
|
|
const result = await userService.verifyPassword(user, 'wrong_password');
|