diff options
author | stanislavh <stanislav.honcharov@sonarsource.com> | 2024-02-13 10:28:04 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-13 20:02:57 +0000 |
commit | 54731d2ee41b89a79d5086f92e6b9a96be88d6bf (patch) | |
tree | 25619045a5b899223b45c325d373f3050a31f9fd | |
parent | 4f02f03c9679752b96a1b5859095922b7aeaf8e0 (diff) | |
download | sonarqube-54731d2ee41b89a79d5086f92e6b9a96be88d6bf.tar.gz sonarqube-54731d2ee41b89a79d5086f92e6b9a96be88d6bf.zip |
[NO-JIRA] Fix typescript issues in design-system for testing utils
-rw-r--r-- | server/sonar-web/design-system/src/helpers/testUtils.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-web/design-system/src/helpers/testUtils.tsx b/server/sonar-web/design-system/src/helpers/testUtils.tsx index 9b9b0fd8a09..f7dc66aba98 100644 --- a/server/sonar-web/design-system/src/helpers/testUtils.tsx +++ b/server/sonar-web/design-system/src/helpers/testUtils.tsx @@ -17,8 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { RenderOptions, render as rtlRender } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import { RenderOptions, RenderResult, render as rtlRender } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; import { Options as UserEventsOptions } from '@testing-library/user-event/dist/types/options'; import { InitialEntry } from 'history'; import { identity, kebabCase } from 'lodash'; @@ -27,11 +27,13 @@ import { HelmetProvider } from 'react-helmet-async'; import { IntlProvider, ReactIntlErrorCode } from 'react-intl'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; +type RenderResultWithUser = RenderResult & { user: UserEvent }; + export function render( ui: React.ReactElement, options?: RenderOptions, userEventOptions?: UserEventsOptions, -) { +): RenderResultWithUser { return { ...rtlRender(ui, options), user: userEvent.setup(userEventOptions) }; } |