You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
Update to React 18
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderHook } from "@testing-library/react-hooks/dom";
|
||||
import { renderHook } from "@testing-library/react";
|
||||
import { MatrixClient, NotificationCountType, Room } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { useRoomThreadNotifications } from "../../../src/hooks/room/useRoomThreadNotifications";
|
||||
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderHook } from "@testing-library/react-hooks";
|
||||
import { renderHook } from "@testing-library/react";
|
||||
|
||||
import { useDebouncedCallback } from "../../src/hooks/spotlight/useDebouncedCallback";
|
||||
|
||||
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderHook, RenderHookResult } from "@testing-library/react-hooks/dom";
|
||||
import { renderHook, RenderHookResult } from "@testing-library/react";
|
||||
|
||||
import { useLatestResult } from "../../src/hooks/useLatestResult";
|
||||
|
||||
@@ -28,7 +28,7 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
function simulateRequest(
|
||||
hookResult: RenderHookResult<typeof useLatestResult, ReturnType<typeof useLatestResult>>["result"],
|
||||
hookResult: RenderHookResult<ReturnType<typeof useLatestResult>, typeof useLatestResult>["result"],
|
||||
{ id, delayInMs, result }: { id: string; delayInMs: number; result: string },
|
||||
) {
|
||||
const [setQuery, setResult] = hookResult.current;
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { act } from "@testing-library/react";
|
||||
import { renderHook } from "@testing-library/react-hooks/dom";
|
||||
import { act, renderHook, waitFor } from "@testing-library/react";
|
||||
import { IPushRules, MatrixClient, PushRuleKind, RuleId } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { useNotificationSettings } from "../../src/hooks/useNotificationSettings";
|
||||
@@ -69,10 +68,9 @@ describe("useNotificationSettings", () => {
|
||||
|
||||
it("correctly parses model", async () => {
|
||||
await act(async () => {
|
||||
const { result, waitForNextUpdate } = renderHook(() => useNotificationSettings(cli));
|
||||
const { result } = renderHook(() => useNotificationSettings(cli));
|
||||
expect(result.current.model).toEqual(null);
|
||||
await waitForNextUpdate();
|
||||
expect(result.current.model).toEqual(expectedModel);
|
||||
await waitFor(() => expect(result.current.model).toEqual(expectedModel));
|
||||
expect(result.current.hasPendingChanges).toBeFalsy();
|
||||
});
|
||||
});
|
||||
@@ -88,14 +86,12 @@ describe("useNotificationSettings", () => {
|
||||
const setPushRuleActions = jest.fn(cli.setPushRuleActions);
|
||||
cli.setPushRuleActions = setPushRuleActions;
|
||||
|
||||
const { result, waitForNextUpdate } = renderHook(() => useNotificationSettings(cli));
|
||||
const { result } = renderHook(() => useNotificationSettings(cli));
|
||||
expect(result.current.model).toEqual(null);
|
||||
await waitForNextUpdate();
|
||||
expect(result.current.model).toEqual(expectedModel);
|
||||
await waitFor(() => expect(result.current.model).toEqual(expectedModel));
|
||||
expect(result.current.hasPendingChanges).toBeFalsy();
|
||||
await result.current.reconcile(DefaultNotificationSettings);
|
||||
await waitForNextUpdate();
|
||||
expect(result.current.hasPendingChanges).toBeFalsy();
|
||||
await waitFor(() => expect(result.current.hasPendingChanges).toBeFalsy());
|
||||
expect(addPushRule).toHaveBeenCalledTimes(0);
|
||||
expect(deletePushRule).toHaveBeenCalledTimes(9);
|
||||
expect(deletePushRule).toHaveBeenCalledWith("global", PushRuleKind.ContentSpecific, "justjann3");
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHook, act } from "@testing-library/react-hooks/dom";
|
||||
import { waitFor, renderHook, act } from "@testing-library/react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { useProfileInfo } from "../../src/hooks/useProfileInfo";
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHook, act } from "@testing-library/react-hooks/dom";
|
||||
import { waitFor, renderHook, act } from "@testing-library/react";
|
||||
import { IRoomDirectoryOptions, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { usePublicRoomDirectory } from "../../src/hooks/usePublicRoomDirectory";
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHook, act } from "@testing-library/react-hooks/dom";
|
||||
import { waitFor, renderHook, act } from "@testing-library/react";
|
||||
import { MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHook, act } from "@testing-library/react-hooks/dom";
|
||||
import { waitFor, renderHook, act } from "@testing-library/react";
|
||||
import { mocked } from "jest-mock";
|
||||
import { SlidingSync } from "matrix-js-sdk/src/sliding-sync";
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderHook } from "@testing-library/react-hooks";
|
||||
import { renderHook } from "@testing-library/react";
|
||||
import { EventStatus, NotificationCountType, PendingEventOrdering, Room } from "matrix-js-sdk/src/matrix";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHook, act } from "@testing-library/react-hooks/dom";
|
||||
import { waitFor, renderHook, act } from "@testing-library/react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { useUserDirectory } from "../../src/hooks/useUserDirectory";
|
||||
|
@@ -15,8 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { renderHook } from "@testing-library/react-hooks";
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import { renderHook, waitFor } from "@testing-library/react";
|
||||
|
||||
import { useUserOnboardingTasks } from "../../src/hooks/useUserOnboardingTasks";
|
||||
import { useUserOnboardingContext } from "../../src/hooks/useUserOnboardingContext";
|
||||
|
@@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { renderHook } from "@testing-library/react-hooks";
|
||||
import { act } from "@testing-library/react";
|
||||
import { renderHook, act } from "@testing-library/react";
|
||||
|
||||
import UIStore, { UI_EVENTS } from "../../src/stores/UIStore";
|
||||
import { useWindowWidth } from "../../src/hooks/useWindowWidth";
|
||||
|
Reference in New Issue
Block a user