Files
n8n-enterprise-unlocked/packages/frontend/editor-ui/src/components/PushConnectionTracker.test.ts
Alex Grozav ed2cb3c701 feat(editor): Update icons to Lucide icons (#16231)
Co-authored-by: Mutasem Aldmour <mutasem@n8n.io>
2025-06-30 17:11:09 +02:00

61 lines
1.5 KiB
TypeScript

import { createComponentRenderer } from '@/__tests__/render';
import PushConnectionTracker from '@/components/PushConnectionTracker.vue';
import { STORES } from '@n8n/stores';
import { createTestingPinia } from '@pinia/testing';
import { setActivePinia } from 'pinia';
let isConnected = true;
let isConnectionRequested = true;
vi.mock('@/stores/pushConnection.store', () => {
return {
usePushConnectionStore: vi.fn(() => ({
isConnected,
isConnectionRequested,
})),
};
});
describe('PushConnectionTracker', () => {
const render = () => {
const pinia = createTestingPinia({
stubActions: false,
initialState: {
[STORES.PUSH]: {
isConnected,
isConnectionRequested,
},
},
});
setActivePinia(pinia);
return createComponentRenderer(PushConnectionTracker, {
global: { stubs: { N8nIcon: true } },
})();
};
it('should not render error when connected and connection requested', () => {
isConnected = true;
isConnectionRequested = true;
const { container } = render();
expect(container).toMatchSnapshot();
});
it('should render error when disconnected and connection requested', () => {
isConnected = false;
isConnectionRequested = true;
const { container } = render();
expect(container).toMatchSnapshot();
});
it('should not render error when connected and connection not requested', () => {
isConnected = true;
isConnectionRequested = false;
const { container } = render();
expect(container).toMatchSnapshot();
});
});