test(users): update unit tests for GDPR consent and export functionality
This commit is contained in:
parent
ea6684b7fa
commit
818a92f18c
@ -212,24 +212,27 @@ describe('UsersService', () => {
|
||||
describe('updateGdprConsent', () => {
|
||||
it('should update GDPR consent timestamp', async () => {
|
||||
const id = 'user1';
|
||||
|
||||
|
||||
// Mock the update method
|
||||
jest.spyOn(service, 'update').mockResolvedValueOnce(mockUser);
|
||||
|
||||
const result = await service.updateGdprConsent(id);
|
||||
|
||||
expect(service.update).toHaveBeenCalledWith(id, { gdprTimestamp: expect.any(Date) });
|
||||
expect(result).toEqual(mockUser);
|
||||
expect(result).toEqual({
|
||||
...mockUser,
|
||||
gdprConsentDate: mockUser.gdprTimestamp
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('exportUserData', () => {
|
||||
it('should export user data', async () => {
|
||||
const id = 'user1';
|
||||
|
||||
|
||||
// Mock the findById method
|
||||
jest.spyOn(service, 'findById').mockResolvedValueOnce(mockUser);
|
||||
|
||||
|
||||
// Mock the database query for projects
|
||||
mockDb.select.mockImplementationOnce(() => mockDbOperations);
|
||||
mockDbOperations.from.mockImplementationOnce(() => mockDbOperations);
|
||||
@ -244,7 +247,9 @@ describe('UsersService', () => {
|
||||
expect(result).toEqual({
|
||||
user: mockUser,
|
||||
projects: [mockProject],
|
||||
groups: [],
|
||||
persons: []
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user