refactor(editor): Move user login and logout side effects into hooks (no-changelog) (#16663)

This commit is contained in:
Alex Grozav
2025-06-25 13:00:52 +03:00
committed by GitHub
parent 6fa4a3eaa1
commit de0293595c
5 changed files with 91 additions and 45 deletions

View File

@@ -2,7 +2,7 @@ import type { CurrentUserResponse } from '@/Interface';
import { useUsersStore } from './users.store';
import { createPinia, setActivePinia } from 'pinia';
const { loginCurrentUser, identify, inviteUsers } = vi.hoisted(() => {
const { loginCurrentUser, inviteUsers } = vi.hoisted(() => {
return {
loginCurrentUser: vi.fn(),
identify: vi.fn(),
@@ -18,12 +18,6 @@ vi.mock('@/api/invitation', () => ({
inviteUsers,
}));
vi.mock('@/composables/useTelemetry', () => ({
useTelemetry: vi.fn(() => ({
identify,
})),
}));
vi.mock('@n8n/stores/useRootStore', () => ({
useRootStore: vi.fn(() => ({
instanceId: 'test-instance-id',
@@ -59,8 +53,6 @@ describe('users.store', () => {
isDefaultUser: false,
isPendingUser: false,
});
expect(identify).toHaveBeenCalledWith('test-instance-id', mockUser.id);
});
});