Use MatrixClientPeg::safeGet in src/components/views/* (#10987)
This commit is contained in:
parent
4243847f4f
commit
280f6a9d93
81 changed files with 265 additions and 250 deletions
|
@ -18,7 +18,7 @@ import React, { ComponentProps } from "react";
|
|||
import { render, fireEvent, RenderResult, waitFor } from "@testing-library/react";
|
||||
import { Room, RoomMember, MatrixError, IContent } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { stubClient } from "../../../test-utils";
|
||||
import { withClientContextRenderOptions, stubClient } from "../../../test-utils";
|
||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||
import RoomPreviewBar from "../../../../src/components/views/rooms/RoomPreviewBar";
|
||||
|
@ -77,7 +77,10 @@ describe("<RoomPreviewBar />", () => {
|
|||
roomId,
|
||||
room: createRoom(roomId, userId),
|
||||
};
|
||||
return render(<RoomPreviewBar {...defaultProps} {...props} />);
|
||||
return render(
|
||||
<RoomPreviewBar {...defaultProps} {...props} />,
|
||||
withClientContextRenderOptions(MatrixClientPeg.safeGet()),
|
||||
);
|
||||
};
|
||||
|
||||
const isSpinnerRendered = (wrapper: RenderResult) => !!wrapper.container.querySelector(".mx_Spinner");
|
||||
|
@ -92,7 +95,10 @@ describe("<RoomPreviewBar />", () => {
|
|||
|
||||
beforeEach(() => {
|
||||
stubClient();
|
||||
MatrixClientPeg.get().getUserId = jest.fn().mockReturnValue(userId);
|
||||
MatrixClientPeg.get().getSafeUserId = jest.fn().mockReturnValue(userId);
|
||||
MatrixClientPeg.safeGet().getUserId = jest.fn().mockReturnValue(userId);
|
||||
MatrixClientPeg.safeGet().getSafeUserId = jest.fn().mockReturnValue(userId);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue