1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-31 13:44:28 +03:00

Replace setImmediate with setTimeout (#12614)

This commit is contained in:
Michael Telatynski
2024-06-13 15:15:59 +01:00
committed by GitHub
parent 21ae29c002
commit 8b4e3e6647
21 changed files with 46 additions and 39 deletions

View File

@ -16,6 +16,7 @@ limitations under the License.
import { mocked } from "jest-mock";
import { SyncState } from "matrix-js-sdk/src/matrix";
import { sleep } from "matrix-js-sdk/src/utils";
import { MatrixClientPeg } from "../../src/MatrixClientPeg";
import ToastStore from "../../src/stores/ToastStore";
@ -40,7 +41,7 @@ describe("LifecycleStore", () => {
prevState: SyncState.Prepared,
});
await new Promise(setImmediate);
await sleep(0);
expect(addOrReplaceToast).not.toHaveBeenCalledWith(
expect.objectContaining({
@ -58,7 +59,7 @@ describe("LifecycleStore", () => {
prevState: SyncState.Prepared,
});
await new Promise(setImmediate);
await sleep(0);
expect(addOrReplaceToast).toHaveBeenCalledWith(
expect.objectContaining({
@ -77,7 +78,7 @@ describe("LifecycleStore", () => {
prevState: SyncState.Prepared,
});
await new Promise(setImmediate);
await sleep(0);
addOrReplaceToast.mock.calls[0][0].props.onAccept();