diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index af71d5349cabf..fc4ebbce15e80 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -889,7 +889,6 @@ export interface RootState { endpointWebhook: string; endpointWebhookTest: string; endpointWebhookWaiting: string; - pushConnectionActive: boolean; timezone: string; executionTimeout: number; maxExecutionTimeout: number; diff --git a/packages/editor-ui/src/components/CanvasChat/CanvasChat.test.ts b/packages/editor-ui/src/components/CanvasChat/CanvasChat.test.ts index 41f27c39c06ba..153b7eabb9b22 100644 --- a/packages/editor-ui/src/components/CanvasChat/CanvasChat.test.ts +++ b/packages/editor-ui/src/components/CanvasChat/CanvasChat.test.ts @@ -38,6 +38,13 @@ vi.mock('@/composables/useToast', () => { }, }; }); + +vi.mock('@/stores/pushConnection.store', () => ({ + usePushConnectionStore: vi.fn().mockReturnValue({ + isConnected: true, + }), +})); + // Test data const mockNodes: INodeUi[] = [ { diff --git a/packages/editor-ui/src/components/MainHeader/WorkflowDetails.test.ts b/packages/editor-ui/src/components/MainHeader/WorkflowDetails.test.ts index d7392a149fa66..06d5555286c87 100644 --- a/packages/editor-ui/src/components/MainHeader/WorkflowDetails.test.ts +++ b/packages/editor-ui/src/components/MainHeader/WorkflowDetails.test.ts @@ -11,6 +11,12 @@ vi.mock('vue-router', () => ({ RouterLink: vi.fn(), })); +vi.mock('@/stores/pushConnection.store', () => ({ + usePushConnectionStore: vi.fn().mockReturnValue({ + isConnected: true, + }), +})); + const initialState = { [STORES.SETTINGS]: { settings: { diff --git a/packages/editor-ui/src/components/PushConnectionTracker.test.ts b/packages/editor-ui/src/components/PushConnectionTracker.test.ts new file mode 100644 index 0000000000000..5e6c37157c848 --- /dev/null +++ b/packages/editor-ui/src/components/PushConnectionTracker.test.ts @@ -0,0 +1,58 @@ +import { createComponentRenderer } from '@/__tests__/render'; +import PushConnectionTracker from '@/components/PushConnectionTracker.vue'; +import { STORES } from '@/constants'; +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)(); + }; + + 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(); + }); +}); diff --git a/packages/editor-ui/src/components/PushConnectionTracker.vue b/packages/editor-ui/src/components/PushConnectionTracker.vue index 66175c2af400e..0ce23634b0ac5 100644 --- a/packages/editor-ui/src/components/PushConnectionTracker.vue +++ b/packages/editor-ui/src/components/PushConnectionTracker.vue @@ -1,16 +1,23 @@