import { afterEach, test, expect, vi, beforeEach } from 'vitest';
import { render } from 'test/utilities';
import TimeZone from '.';
beforeEach(() => {
// freeze time
vi.useFakeTimers();
// set system time to a certain point
vi.setSystemTime(1679492355195);
});
test('it should render successfully', () => {
render(<TimeZone />);
});
test('should match the snapshot', async () => {
const { container } = render(<TimeZone />);
expect(container).toMatchSnapshot();
});
afterEach(() => {
vi.useRealTimers();
});
标签:Vitest,render,vi,testing,afterEach,Time,test,import From: https://www.cnblogs.com/Answer1215/p/17734413.html