mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(editor): VariablesView Reskin - Add Filters for missing values (#12611)
This commit is contained in:
committed by
GitHub
parent
652b8d170b
commit
1eeb788d32
@@ -0,0 +1,31 @@
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import VariablesUsageBadge from './VariablesUsageBadge.vue';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
const renderComponent = createComponentRenderer(VariablesUsageBadge);
|
||||
|
||||
const showMessage = vi.fn();
|
||||
vi.mock('@/composables/useToast', () => ({
|
||||
useToast: () => ({ showMessage }),
|
||||
}));
|
||||
|
||||
const copy = vi.fn();
|
||||
vi.mock('@/composables/useClipboard', () => ({
|
||||
useClipboard: () => ({ copy }),
|
||||
}));
|
||||
|
||||
describe('VariablesUsageBadge', () => {
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should copy to the clipboard', async () => {
|
||||
const name = 'myVar';
|
||||
const output = `$vars.${name}`;
|
||||
const { getByText } = renderComponent({ props: { name } });
|
||||
await userEvent.click(getByText(output));
|
||||
|
||||
expect(showMessage).toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }));
|
||||
expect(copy).toHaveBeenCalledWith(output);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user