test: Update message test case (#38766)

This commit is contained in:
hms181231 2022-11-21 00:51:58 +08:00 committed by GitHub
parent cef8bf899c
commit f9ef37e9be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import React from 'react';
import { SmileOutlined } from '@ant-design/icons';
import message, { actWrapper } from '..';
import { act, fireEvent, sleep } from '../../../tests/utils';
import { act, fireEvent, waitFakeTimer } from '../../../tests/utils';
import { awaitPromise, triggerMotionEnd } from './util';
describe('message', () => {
@ -139,7 +139,7 @@ describe('message', () => {
act(() => {
jest.advanceTimersByTime(1000);
});
await sleep(); // Wait to let event loop run
await waitFakeTimer(); // Wait to let event loop run
expect(onClose).toHaveBeenCalled();
});