Switch from defer to Promise.withResolvers (#29078)

* Switch from defer to PromiseWithResolvers

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add modernizr check

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-05-08 11:03:43 +01:00
committed by GitHub
parent 0f783ede5e
commit a3f5d207de
34 changed files with 61 additions and 89 deletions

View File

@@ -7,7 +7,7 @@
import React from "react";
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
import { sleep, defer } from "matrix-js-sdk/src/utils";
import { sleep } from "matrix-js-sdk/src/utils";
import { render, screen } from "jest-matrix-react";
import userEvent from "@testing-library/user-event";
@@ -33,7 +33,7 @@ describe("<ResetIdentityPanel />", () => {
// We need to pause the reset so that we can check that it's providing
// feedback to the user that something is happening.
const { promise: resetEncryptionPromise, resolve: resolveResetEncryption } = defer();
const { promise: resetEncryptionPromise, resolve: resolveResetEncryption } = Promise.withResolvers<void>();
jest.spyOn(matrixClient.getCrypto()!, "resetEncryption").mockReturnValue(resetEncryptionPromise);
const continueButton = screen.getByRole("button", { name: "Continue" });