mirror of https://github.com/buster-so/buster.git
62 lines
1.1 KiB
TypeScript
62 lines
1.1 KiB
TypeScript
|
// Learn more: https://github.com/testing-library/jest-dom
|
||
|
import '@testing-library/jest-dom';
|
||
|
import { vi } from 'vitest';
|
||
|
|
||
|
// Mock Next.js router
|
||
|
vi.mock('next/router', () => ({
|
||
|
useRouter() {
|
||
|
return {
|
||
|
route: '/',
|
||
|
pathname: '',
|
||
|
query: {},
|
||
|
asPath: '',
|
||
|
push: vi.fn(),
|
||
|
replace: vi.fn(),
|
||
|
reload: vi.fn(),
|
||
|
back: vi.fn(),
|
||
|
prefetch: vi.fn(),
|
||
|
beforePopState: vi.fn(),
|
||
|
events: {
|
||
|
on: vi.fn(),
|
||
|
off: vi.fn(),
|
||
|
emit: vi.fn()
|
||
|
},
|
||
|
isFallback: false
|
||
|
};
|
||
|
}
|
||
|
}));
|
||
|
|
||
|
// Mock next/navigation
|
||
|
vi.mock('next/navigation', () => ({
|
||
|
useRouter() {
|
||
|
return {
|
||
|
push: vi.fn(),
|
||
|
replace: vi.fn(),
|
||
|
refresh: vi.fn(),
|
||
|
back: vi.fn(),
|
||
|
forward: vi.fn()
|
||
|
};
|
||
|
},
|
||
|
usePathname() {
|
||
|
return '';
|
||
|
},
|
||
|
useSearchParams() {
|
||
|
return new URLSearchParams();
|
||
|
}
|
||
|
}));
|
||
|
|
||
|
// Mock react-hotkeys-hook
|
||
|
vi.mock('react-hotkeys-hook', () => ({
|
||
|
useHotkeys: vi.fn()
|
||
|
}));
|
||
|
|
||
|
vi.mock('react-markdown', () => ({
|
||
|
__esModule: true,
|
||
|
default: vi.fn()
|
||
|
}));
|
||
|
|
||
|
vi.mock('remark-gfm', () => ({
|
||
|
__esModule: true,
|
||
|
default: vi.fn()
|
||
|
}));
|