mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
fix: failing test cases due to isEventObject, add to mock
This commit is contained in:
parent
7616cb89e4
commit
cb99ee1ac1
@ -18,6 +18,26 @@ interface UseSafeNavigateReturn {
|
||||
>;
|
||||
}
|
||||
|
||||
export const isEventObject = (
|
||||
arg: unknown,
|
||||
): arg is
|
||||
| MouseEvent
|
||||
| KeyboardEvent
|
||||
| React.MouseEvent
|
||||
| React.KeyboardEvent => {
|
||||
if (!arg || typeof arg !== 'object') return false;
|
||||
|
||||
return (
|
||||
arg instanceof MouseEvent ||
|
||||
arg instanceof KeyboardEvent ||
|
||||
('nativeEvent' in arg &&
|
||||
(arg.nativeEvent instanceof MouseEvent ||
|
||||
arg.nativeEvent instanceof KeyboardEvent)) ||
|
||||
'metaKey' in arg ||
|
||||
'ctrlKey' in arg
|
||||
);
|
||||
};
|
||||
|
||||
export const useSafeNavigate = (): UseSafeNavigateReturn => ({
|
||||
safeNavigate: jest.fn(
|
||||
(to: SafeNavigateToType, options?: SafeNavigateOptions) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user