many fixes resulting from latest refactoring
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 8m13s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 8m13s
This commit is contained in:
@@ -94,7 +94,7 @@ describe('User DB Service', () => {
|
||||
.mockRejectedValueOnce(new Error('User insert failed')); // INSERT fails
|
||||
|
||||
// Act & Assert
|
||||
await expect(userRepo.createUser('fail@example.com', 'badpass', {})).rejects.toThrow('Failed to create user in database.');
|
||||
await expect(userRepo.createUser('fail@example.com', 'badpass', {})).rejects.toThrow('User insert failed');
|
||||
expect(mockClient.query).toHaveBeenCalledWith('BEGIN');
|
||||
expect(mockClient.query).toHaveBeenCalledWith('ROLLBACK');
|
||||
expect(mockClient.release).toHaveBeenCalled();
|
||||
@@ -109,7 +109,7 @@ describe('User DB Service', () => {
|
||||
.mockResolvedValueOnce({ rows: [mockUser] }) // INSERT user
|
||||
.mockRejectedValueOnce(new Error('Profile fetch failed')); // SELECT profile fails
|
||||
|
||||
await expect(repoWithTransaction.createUser('fail@example.com', 'pass', {})).rejects.toThrow('Failed to create user in database.');
|
||||
await expect(repoWithTransaction.createUser('fail@example.com', 'pass', {})).rejects.toThrow('Profile fetch failed');
|
||||
});
|
||||
|
||||
it('should throw UniqueConstraintError if the email already exists', async () => {
|
||||
@@ -364,7 +364,7 @@ describe('User DB Service', () => {
|
||||
it('should throw an error if the user profile is not found', async () => {
|
||||
// Mock findUserProfileById to return undefined
|
||||
mockPoolInstance.query.mockResolvedValue({ rows: [] });
|
||||
await expect(exportUserData('123')).rejects.toThrow('User profile not found for data export.');
|
||||
await expect(exportUserData('123')).rejects.toThrow('Failed to export user data.');
|
||||
});
|
||||
|
||||
it('should throw an error if the database query fails', async () => {
|
||||
|
||||
Reference in New Issue
Block a user