Change module API to be an instance getter (#31025)
* Change module API to be an instance getter Helps with circular dependencies by not instantating the module API on the initial evaluation of the files. * Add basic test * add another test
This commit is contained in:
@@ -16,7 +16,7 @@ import { MatrixClientPeg } from "../../../../../src/MatrixClientPeg";
|
||||
import DMRoomMap from "../../../../../src/utils/DMRoomMap";
|
||||
import RoomPreviewBar from "../../../../../src/components/views/rooms/RoomPreviewBar";
|
||||
import defaultDispatcher from "../../../../../src/dispatcher/dispatcher";
|
||||
import ModuleApi from "../../../../../src/modules/Api.ts";
|
||||
import { ModuleApi } from "../../../../../src/modules/Api.ts";
|
||||
|
||||
jest.mock("../../../../../src/IdentityAuthClient", () => {
|
||||
return jest.fn().mockImplementation(() => {
|
||||
@@ -500,7 +500,7 @@ describe("<RoomPreviewBar />", () => {
|
||||
});
|
||||
|
||||
it("should render Module roomPreviewBarRenderer if specified", () => {
|
||||
jest.spyOn(ModuleApi.customComponents, "roomPreviewBarRenderer", "get").mockReturnValue(() => (
|
||||
jest.spyOn(ModuleApi.instance.customComponents, "roomPreviewBarRenderer", "get").mockReturnValue(() => (
|
||||
<>Test component</>
|
||||
));
|
||||
const { getByText } = render(<RoomPreviewBar />);
|
||||
|
||||
Reference in New Issue
Block a user