Migrate more jest tests to vitest (#33922)

* Migrate more jest tests to vitest

* Fix jest config

* Fix jest config

* Make remaining jest tests type-happy

* Iterate

* Fix Notifier import cycle

* Fix tests

* Delint

* Iterate

* 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

* Iterate

* Simplify diff

* Improve coverage

* Improve coverage

* Iterate
This commit is contained in:
Michael Telatynski
2026-07-07 09:50:40 +00:00
committed by GitHub
parent 30c02ab5d7
commit 6fda0ad60f
10 changed files with 120 additions and 88 deletions
@@ -10,7 +10,9 @@ import React, { type ReactElement } from "react";
// eslint-disable-next-line no-restricted-imports
import { render, type RenderOptions } from "@testing-library/react";
import { TooltipProvider } from "@vector-im/compound-web";
import { I18nContext } from "@element-hq/web-shared-components";
import { I18nApi, I18nContext } from "@element-hq/web-shared-components";
const i18nApi = new I18nApi();
/**
* Wraps the provided components in:
@@ -26,7 +28,7 @@ const wrapWithStandardContexts = (Wrapper: RenderOptions["wrapper"]) => {
if (Wrapper) {
return (
<Wrapper>
<I18nContext.Provider value={window.mxModuleApi.i18n}>
<I18nContext.Provider value={i18nApi}>
<TooltipProvider>{children}</TooltipProvider>
</I18nContext.Provider>
</Wrapper>
@@ -34,7 +36,7 @@ const wrapWithStandardContexts = (Wrapper: RenderOptions["wrapper"]) => {
} else {
return (
<TooltipProvider>
<I18nContext.Provider value={window.mxModuleApi.i18n}>{children}</I18nContext.Provider>
<I18nContext.Provider value={i18nApi}>{children}</I18nContext.Provider>
</TooltipProvider>
);
}