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:
@@ -18,7 +18,6 @@ import {
|
||||
SearchResult,
|
||||
type ISearchResults,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { defer } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { RoomSearchView } from "../../../../src/components/structures/RoomSearchView";
|
||||
import ResizeNotifier from "../../../../src/utils/ResizeNotifier";
|
||||
@@ -53,7 +52,7 @@ describe("<RoomSearchView/>", () => {
|
||||
});
|
||||
|
||||
it("should show a spinner before the promise resolves", async () => {
|
||||
const deferred = defer<ISearchResults>();
|
||||
const deferred = Promise.withResolvers<ISearchResults>();
|
||||
|
||||
render(
|
||||
<RoomSearchView
|
||||
@@ -267,7 +266,7 @@ describe("<RoomSearchView/>", () => {
|
||||
});
|
||||
|
||||
it("should handle resolutions after unmounting sanely", async () => {
|
||||
const deferred = defer<ISearchResults>();
|
||||
const deferred = Promise.withResolvers<ISearchResults>();
|
||||
|
||||
const { unmount } = render(
|
||||
<MatrixClientContext.Provider value={client}>
|
||||
@@ -291,7 +290,7 @@ describe("<RoomSearchView/>", () => {
|
||||
});
|
||||
|
||||
it("should handle rejections after unmounting sanely", async () => {
|
||||
const deferred = defer<ISearchResults>();
|
||||
const deferred = Promise.withResolvers<ISearchResults>();
|
||||
|
||||
const { unmount } = render(
|
||||
<MatrixClientContext.Provider value={client}>
|
||||
@@ -316,7 +315,7 @@ describe("<RoomSearchView/>", () => {
|
||||
|
||||
it("report error if one is encountered", async () => {
|
||||
const onUpdate = jest.fn();
|
||||
const deferred = defer<ISearchResults>();
|
||||
const deferred = Promise.withResolvers<ISearchResults>();
|
||||
|
||||
render(
|
||||
<MatrixClientContext.Provider value={client}>
|
||||
|
||||
Reference in New Issue
Block a user