Expose SDKContext on the window & avoid using singleton store .instance (#34098)
* Expose SDKContextClass via window for debugging * Remove stores from window if they are exposed via sdkContext * Avoid usages of global store instance where React context is accessible * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Fix tests by adding SDKContext.Provider * Iterate * Discard changes to apps/web/src/components/views/elements/AppTile.tsx
This commit is contained in:
@@ -37,6 +37,7 @@ import { ScopedRoomContextProvider } from "../../../../src/contexts/ScopedRoomCo
|
||||
import { untilDispatch } from "../../../test-utils/utilities.ts";
|
||||
import { TimelineRenderingType } from "../../../../src/contexts/RoomContext.ts";
|
||||
import { type ComposerInsertPayload, ComposerType } from "../../../../src/dispatcher/payloads/ComposerInsertPayload.ts";
|
||||
import { SDKContext } from "../../../../src/contexts/SDKContext.ts";
|
||||
|
||||
describe("ThreadView", () => {
|
||||
const ROOM_ID = "!roomId:example.org";
|
||||
@@ -73,7 +74,11 @@ describe("ThreadView", () => {
|
||||
}
|
||||
|
||||
async function getComponent(initialEvent?: MatrixEvent): Promise<RenderResult> {
|
||||
const renderResult = render(<TestThreadView initialEvent={initialEvent} />);
|
||||
const renderResult = render(<TestThreadView initialEvent={initialEvent} />, {
|
||||
wrapper: ({ children }) => (
|
||||
<SDKContext.Provider value={SDKContextClass.instance}>{children}</SDKContext.Provider>
|
||||
),
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(() => getByTestId(renderResult.container, "spinner")).toThrow();
|
||||
|
||||
Reference in New Issue
Block a user