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