Separate out SDKContext (#34053)
* Separate out SDKContext ...from SDKContextClass, as the comments hopefully explain. Also make the captitalisation consistent. * Adding the new file usually helps too * Fix import * More comment * Update the various imports of SDKContextClass * Also fix case of TestSDKContext * Update the mock
This commit is contained in:
@@ -13,7 +13,7 @@ import { mocked } from "jest-mock";
|
||||
|
||||
import QuickSettingsButton from "../../../../../src/components/views/spaces/QuickSettingsButton";
|
||||
import SettingsStore from "../../../../../src/settings/SettingsStore";
|
||||
import { SdkContextClass } from "../../../../../src/contexts/SDKContext";
|
||||
import { SDKContextClass } from "../../../../../src/contexts/SDKContextClass";
|
||||
|
||||
describe("QuickSettingsButton", () => {
|
||||
const roomId = "!room:example.com";
|
||||
@@ -72,11 +72,11 @@ describe("QuickSettingsButton", () => {
|
||||
|
||||
describe("and a room is viewed", () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(SdkContextClass.instance.roomViewStore, "getRoomId").mockReturnValue(roomId);
|
||||
jest.spyOn(SDKContextClass.instance.roomViewStore, "getRoomId").mockReturnValue(roomId);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mocked(SdkContextClass.instance.roomViewStore.getRoomId).mockRestore();
|
||||
mocked(SDKContextClass.instance.roomViewStore.getRoomId).mockRestore();
|
||||
});
|
||||
|
||||
describe("and the quick settings are open", () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { MetaSpace, type SpaceKey } from "../../../../../src/stores/spaces";
|
||||
import { shouldShowComponent } from "../../../../../src/customisations/helpers/UIComponents";
|
||||
import { UIComponent } from "../../../../../src/settings/UIFeature";
|
||||
import { mkStubRoom, wrapInMatrixClientContext, wrapInSdkContext } from "../../../../test-utils";
|
||||
import { SdkContextClass } from "../../../../../src/contexts/SDKContext";
|
||||
import { SDKContextClass } from "../../../../../src/contexts/SDKContextClass";
|
||||
import SpaceStore from "../../../../../src/stores/spaces/SpaceStore";
|
||||
import DMRoomMap from "../../../../../src/utils/DMRoomMap";
|
||||
import { type SpaceNotificationState } from "../../../../../src/stores/notifications/SpaceNotificationState";
|
||||
@@ -124,12 +124,12 @@ describe("<SpacePanel />", () => {
|
||||
isVersionSupported: jest.fn().mockResolvedValue(true),
|
||||
doesServerSupportUnstableFeature: jest.fn().mockResolvedValue(false),
|
||||
} as unknown as MatrixClient;
|
||||
const SpacePanel = wrapInSdkContext(wrapInMatrixClientContext(UnwrappedSpacePanel), SdkContextClass.instance);
|
||||
const SpacePanel = wrapInSdkContext(wrapInMatrixClientContext(UnwrappedSpacePanel), SDKContextClass.instance);
|
||||
|
||||
beforeAll(() => {
|
||||
jest.spyOn(MatrixClientPeg, "get").mockReturnValue(mockClient);
|
||||
jest.spyOn(MatrixClientPeg, "safeGet").mockReturnValue(mockClient);
|
||||
SdkContextClass.instance.client = mockClient;
|
||||
SDKContextClass.instance.client = mockClient;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user