mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(editor): Remove i18n and toast usage from setting store (no-changelog) (#16721)
This commit is contained in:
@@ -18,9 +18,10 @@ import { EnterpriseEditionFeature } from '@/constants';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
|
||||
const showMessage = vi.fn();
|
||||
const showToast = vi.fn();
|
||||
|
||||
vi.mock('@/composables/useToast', () => ({
|
||||
useToast: () => ({ showMessage }),
|
||||
useToast: () => ({ showMessage, showToast }),
|
||||
}));
|
||||
|
||||
vi.mock('@/stores/users.store', () => ({
|
||||
@@ -90,6 +91,23 @@ describe('Init', () => {
|
||||
expect(settingsStoreSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should throw an error if settings initialization fails', async () => {
|
||||
const error = new Error('Settings initialization failed');
|
||||
|
||||
vi.spyOn(settingsStore, 'initialize').mockImplementation(() => {
|
||||
throw error;
|
||||
});
|
||||
|
||||
await initializeCore();
|
||||
|
||||
expect(showToast).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
title: 'Error connecting to n8n',
|
||||
type: 'error',
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should initialize authentication hooks', async () => {
|
||||
const registerLoginHookSpy = vi.spyOn(usersStore, 'registerLoginHook');
|
||||
const registerLogoutHookSpy = vi.spyOn(usersStore, 'registerLogoutHook');
|
||||
|
||||
Reference in New Issue
Block a user