mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
add unit tests
This commit is contained in:
parent
47e80f70a6
commit
8e2a562220
|
@ -3,6 +3,17 @@ import type { ExecutionSummary } from 'n8n-workflow';
|
|||
import { i18n } from '@/plugins/i18n';
|
||||
import { convertToDisplayDate } from '@/utils/formatters/dateFormatter';
|
||||
|
||||
const { resolve } = vi.hoisted(() => ({
|
||||
resolve: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('vue-router', () => ({
|
||||
useRouter: () => ({
|
||||
resolve,
|
||||
}),
|
||||
RouterLink: vi.fn(),
|
||||
}));
|
||||
|
||||
describe('useExecutionHelpers()', () => {
|
||||
describe('getUIDetails()', () => {
|
||||
it.each([
|
||||
|
@ -68,4 +79,18 @@ describe('useExecutionHelpers()', () => {
|
|||
).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('openExecutionInNewTab', () => {
|
||||
const executionId = '123';
|
||||
const workflowId = 'xyz';
|
||||
const href = 'test.com';
|
||||
global.window.open = vi.fn();
|
||||
|
||||
it('opens execution in new tab', () => {
|
||||
const { openExecutionInNewTab } = useExecutionHelpers();
|
||||
resolve.mockReturnValue({ href });
|
||||
openExecutionInNewTab(executionId, workflowId);
|
||||
expect(window.open).toHaveBeenCalledWith(href, '_blank');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue