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:
@@ -48,11 +48,12 @@ describe("<Pill>", () => {
|
||||
const user3Id = "@user3:example.com";
|
||||
let renderResult: RenderResult;
|
||||
let pillParentClickHandler: (e: ButtonEvent) => void;
|
||||
let sdkContext: TestSDKContext;
|
||||
|
||||
const renderPill = (props: PillProps): void => {
|
||||
const cli = MatrixClientPeg.safeGet();
|
||||
const mockSdkContext = new TestSDKContext();
|
||||
mockSdkContext.client = cli;
|
||||
mockSdkContext._client = cli;
|
||||
|
||||
const withDefault = {
|
||||
inMessage: true,
|
||||
@@ -79,7 +80,10 @@ describe("<Pill>", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
client = mocked(stubClient());
|
||||
SDKContextClass.instance.client = client;
|
||||
sdkContext = new TestSDKContext();
|
||||
// @ts-ignore Pill uses the SDKContext global
|
||||
SDKContextClass.instance = sdkContext;
|
||||
sdkContext._client = client;
|
||||
DMRoomMap.makeShared(client);
|
||||
room1 = new Room(room1Id, client, user1Id);
|
||||
room1.name = "Room 1";
|
||||
|
||||
Reference in New Issue
Block a user