Replace setImmediate with setTimeout (#12614)
This commit is contained in:
parent
21ae29c002
commit
8b4e3e6647
21 changed files with 46 additions and 39 deletions
|
@ -26,6 +26,7 @@ import {
|
|||
} from "matrix-js-sdk/src/matrix";
|
||||
import { act, fireEvent, getByTestId, render, RenderResult, screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { sleep } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import ForwardDialog from "../../../../src/components/views/dialogs/ForwardDialog";
|
||||
|
@ -199,7 +200,7 @@ describe("ForwardDialog", () => {
|
|||
await act(async () => {
|
||||
cancelSend();
|
||||
// Wait one tick for the button to realize the send failed
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
await sleep(0);
|
||||
});
|
||||
update();
|
||||
expect(firstButton.className).toContain("mx_ForwardList_sendFailed");
|
||||
|
@ -215,7 +216,7 @@ describe("ForwardDialog", () => {
|
|||
await act(async () => {
|
||||
finishSend();
|
||||
// Wait one tick for the button to realize the send succeeded
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
await sleep(0);
|
||||
});
|
||||
update();
|
||||
expect(secondButton.className).toContain("mx_ForwardList_sent");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue