Files
n8n/packages/frontend/editor-ui/src/app/components/ChatEmbedModal.test.ts
T
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

42 lines
1.3 KiB
TypeScript

import ChatEmbedModal from '@/app/components/ChatEmbedModal.vue';
import { createTestingPinia } from '@pinia/testing';
import { CHAT_EMBED_MODAL_KEY, WEBHOOK_NODE_TYPE } from '@/app/constants';
import { STORES } from '@n8n/stores';
import { createComponentRenderer } from '@/__tests__/render';
import { waitFor } from '@testing-library/vue';
const renderComponent = createComponentRenderer(ChatEmbedModal, {
pinia: createTestingPinia({
initialState: {
[STORES.UI]: {
modalsById: {
[CHAT_EMBED_MODAL_KEY]: { open: true },
},
},
[STORES.WORKFLOWS]: {
workflow: {
nodes: [{ type: WEBHOOK_NODE_TYPE }],
},
},
},
}),
});
describe('ChatEmbedModal', () => {
it('should render correctly', async () => {
const { getByTestId } = renderComponent();
await waitFor(() => expect(getByTestId('chatEmbed-modal')).toBeInTheDocument());
const modalContainer = getByTestId('chatEmbed-modal');
const tabs = modalContainer.querySelectorAll('.n8n-tabs .tab');
const activeTab = modalContainer.querySelector('.n8n-tabs .tab.activeTab');
const editor = modalContainer.querySelector('.cm-editor');
expect(tabs).toHaveLength(4);
expect(activeTab).toBeVisible();
expect(activeTab).toHaveTextContent('CDN Embed');
expect(editor).toBeVisible();
});
});