Update tests to use vi instead of jest

This commit is contained in:
Alejandro Celaya
2023-05-27 11:57:26 +02:00
parent e2cbb2713a
commit 07fcb4e016
117 changed files with 3699 additions and 325 deletions

View File

@@ -8,17 +8,17 @@ const ComponentWithError = () => {
};
describe('<ErrorHandler />', () => {
const reload = jest.fn();
const reload = vi.fn();
const window = fromPartial<Window>({
location: { reload },
});
const cons = fromPartial<Console>({ error: jest.fn() });
const cons = fromPartial<Console>({ error: vi.fn() });
const ErrorHandler = createErrorHandler(window, cons);
beforeEach(() => {
jest.spyOn(console, 'error').mockImplementation(() => {}); // Silence react errors
vi.spyOn(console, 'error').mockImplementation(() => {}); // Silence react errors
});
afterEach(jest.resetAllMocks);
afterEach(vi.resetAllMocks);
it('renders children when no error has occurred', () => {
render(<ErrorHandler children={<span>Foo</span>} />);