Handle SDKContextClass client initialisation internally (#34146)

* Handle SDKContextClass `client` initialisation internally

Rather than via MatrixChat - this is predominantly for Lifecycle tests as they don't use a MatrixChat and it doesn't make much sense for this component to own this state.

* Fix tests
This commit is contained in:
Michael Telatynski
2026-07-06 16:09:21 +00:00
committed by GitHub
parent 20587b3495
commit dc33d736a0
30 changed files with 137 additions and 71 deletions
@@ -23,8 +23,8 @@ import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelS
import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore";
import { UPDATE_EVENT } from "../../../../src/stores/AsyncStore";
import { WidgetLayoutStore } from "../../../../src/stores/widgets/WidgetLayoutStore";
import { SDKContextClass } from "../../../../src/contexts/SDKContextClass";
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
import { TestSDKContext } from "../../TestSDKContext.ts";
const RightPanelBase = wrapInMatrixClientContext(_RightPanel);
@@ -32,14 +32,14 @@ describe("RightPanel", () => {
const resizeNotifier = new ResizeNotifier();
let cli: MockedObject<MatrixClient>;
let context: SDKContextClass;
let context: TestSDKContext;
let RightPanel: React.ComponentType<React.ComponentProps<typeof RightPanelBase>>;
beforeEach(() => {
stubClient();
cli = mocked(MatrixClientPeg.safeGet());
DMRoomMap.makeShared(cli);
context = new SDKContextClass();
context.client = cli;
context = new TestSDKContext();
context._client = cli;
RightPanel = wrapInSdkContext(RightPanelBase, context);
});