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:
+4
-3
@@ -15,7 +15,8 @@ import { type MockedObject } from "jest-mock-vitest-adapter";
|
||||
import { ToastContext, ToastRack } from "@element-hq/web-shared-components";
|
||||
|
||||
import AccountUserSettingsTab from "../../../../../../../src/components/views/settings/tabs/user/AccountUserSettingsTab";
|
||||
import { SdkContextClass, SDKContext } from "../../../../../../../src/contexts/SDKContext";
|
||||
import { SDKContext } from "../../../../../../../src/contexts/SDKContext";
|
||||
import { SDKContextClass } from "../../../../../../../src/contexts/SDKContextClass";
|
||||
import SettingsStore from "../../../../../../../src/settings/SettingsStore";
|
||||
import {
|
||||
getMockClientWithEventEmitter,
|
||||
@@ -50,7 +51,7 @@ describe("<AccountUserSettingsTab />", () => {
|
||||
const userId = "@alice:server.org";
|
||||
let mockClient: MockedObject<MatrixClient>;
|
||||
|
||||
let stores: SdkContextClass;
|
||||
let stores: SDKContextClass;
|
||||
|
||||
const getComponent = () => (
|
||||
<MatrixClientContext.Provider value={mockClient}>
|
||||
@@ -86,7 +87,7 @@ describe("<AccountUserSettingsTab />", () => {
|
||||
id_server_unbind_result: "success",
|
||||
});
|
||||
|
||||
stores = new SdkContextClass();
|
||||
stores = new SDKContextClass();
|
||||
stores.client = mockClient;
|
||||
// stub out this store completely to avoid mocking initialisation
|
||||
const mockOidcClientStore = {} as unknown as OidcClientStore;
|
||||
|
||||
+3
-2
@@ -19,7 +19,8 @@ import {
|
||||
mockClientMethodsDevice,
|
||||
mockPlatformPeg,
|
||||
} from "../../../../../../test-utils";
|
||||
import { SDKContext, SdkContextClass } from "../../../../../../../src/contexts/SDKContext";
|
||||
import { SDKContext } from "../../../../../../../src/contexts/SDKContext";
|
||||
import { SDKContextClass } from "../../../../../../../src/contexts/SDKContextClass";
|
||||
import defaultDispatcher from "../../../../../../../src/dispatcher/dispatcher";
|
||||
import { UIFeature } from "../../../../../../../src/settings/UIFeature";
|
||||
import SettingsStore from "../../../../../../../src/settings/SettingsStore";
|
||||
@@ -41,7 +42,7 @@ describe("<SecurityUserSettingsTab />", () => {
|
||||
setIgnoredUsers,
|
||||
});
|
||||
|
||||
const sdkContext = new SdkContextClass();
|
||||
const sdkContext = new SDKContextClass();
|
||||
sdkContext.client = mockClient;
|
||||
|
||||
const getComponent = () => (
|
||||
|
||||
+4
-3
@@ -56,7 +56,8 @@ import {
|
||||
import { INACTIVE_DEVICE_AGE_MS } from "../../../../../../../src/components/views/settings/devices/filter";
|
||||
import SettingsStore from "../../../../../../../src/settings/SettingsStore";
|
||||
import { getClientInformationEventType } from "../../../../../../../src/utils/device/clientInformation";
|
||||
import { SDKContext, SdkContextClass } from "../../../../../../../src/contexts/SDKContext";
|
||||
import { SDKContext } from "../../../../../../../src/contexts/SDKContext";
|
||||
import { SDKContextClass } from "../../../../../../../src/contexts/SDKContextClass";
|
||||
import { type OidcClientStore } from "../../../../../../../src/stores/oidc/OidcClientStore";
|
||||
import { makeDelegatedAuthConfig } from "../../../../../../test-utils/oidc";
|
||||
import MatrixClientContext from "../../../../../../../src/contexts/MatrixClientContext";
|
||||
@@ -133,7 +134,7 @@ describe("<SessionManagerTab />", () => {
|
||||
} as unknown as CryptoApi);
|
||||
|
||||
let mockClient!: MockedObject<MatrixClient>;
|
||||
let sdkContext: SdkContextClass;
|
||||
let sdkContext: SDKContextClass;
|
||||
|
||||
const defaultProps = {};
|
||||
const getComponent = (props = {}): React.ReactElement => (
|
||||
@@ -249,7 +250,7 @@ describe("<SessionManagerTab />", () => {
|
||||
}
|
||||
});
|
||||
|
||||
sdkContext = new SdkContextClass();
|
||||
sdkContext = new SDKContextClass();
|
||||
sdkContext.client = mockClient;
|
||||
|
||||
// @ts-ignore allow delete of non-optional prop
|
||||
|
||||
Reference in New Issue
Block a user