mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
fix(core): Fix user telemetry bugs (#10293)
This commit is contained in:
@@ -46,6 +46,7 @@ describe('MeController', () => {
|
||||
it('should update the user in the DB, and issue a new cookie', async () => {
|
||||
const user = mock<User>({
|
||||
id: '123',
|
||||
email: 'valid@email.com',
|
||||
password: 'password',
|
||||
authIdentities: [],
|
||||
role: 'global:owner',
|
||||
@@ -53,6 +54,7 @@ describe('MeController', () => {
|
||||
const reqBody = { email: 'valid@email.com', firstName: 'John', lastName: 'Potato' };
|
||||
const req = mock<MeRequest.UserUpdate>({ user, body: reqBody, browserId });
|
||||
const res = mock<Response>();
|
||||
userRepository.findOneByOrFail.mockResolvedValue(user);
|
||||
userRepository.findOneOrFail.mockResolvedValue(user);
|
||||
jest.spyOn(jwt, 'sign').mockImplementation(() => 'signed-token');
|
||||
userService.toPublic.mockResolvedValue({} as unknown as PublicUser);
|
||||
@@ -66,7 +68,10 @@ describe('MeController', () => {
|
||||
]);
|
||||
|
||||
expect(userService.update).toHaveBeenCalled();
|
||||
|
||||
expect(eventService.emit).toHaveBeenCalledWith('user-updated', {
|
||||
user,
|
||||
fieldsChanged: ['firstName', 'lastName'], // email did not change
|
||||
});
|
||||
expect(res.cookie).toHaveBeenCalledWith(
|
||||
AUTH_COOKIE_NAME,
|
||||
'signed-token',
|
||||
|
||||
Reference in New Issue
Block a user