test: high coverage for all UI tests
This commit is contained in:
committed by
Gerla, J. (Justin)
parent
c639a37dfc
commit
086caea737
24
test/test-utils/test-utils.tsx
Normal file
24
test/test-utils/test-utils.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
// __tests__/utils/test-utils.tsx
|
||||
import { render, type RenderOptions } from '@testing-library/react';
|
||||
import { type ReactElement, type ReactNode } from 'react';
|
||||
import { ReactFlowProvider } from '@xyflow/react';
|
||||
|
||||
/**
|
||||
* Custom render function that wraps components with necessary providers
|
||||
* This ensures all components have access to ReactFlow context
|
||||
*/
|
||||
export function renderWithProviders(
|
||||
ui: ReactElement,
|
||||
options?: Omit<RenderOptions, 'wrapper'>
|
||||
) {
|
||||
function Wrapper({ children }: { children: ReactNode }) {
|
||||
return <ReactFlowProvider>{children}</ReactFlowProvider>;
|
||||
}
|
||||
|
||||
return render(ui, { wrapper: Wrapper, ...options });
|
||||
}
|
||||
|
||||
|
||||
// Re-export everything from testing library
|
||||
//eslint-disable-next-line react-refresh/only-export-components
|
||||
export * from '@testing-library/react';
|
||||
Reference in New Issue
Block a user