@lf94 nit
This commit is contained in:
@ -2,7 +2,11 @@ import { fireEvent, render, screen } from '@testing-library/react'
|
|||||||
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
||||||
import { OpenInDesktopAppHandler } from './OpenInDesktopAppHandler'
|
import { OpenInDesktopAppHandler } from './OpenInDesktopAppHandler'
|
||||||
|
|
||||||
function TestWrap({
|
/**
|
||||||
|
* The behavior under test requires a router,
|
||||||
|
* so we wrap the component in a minimal router setup.
|
||||||
|
*/
|
||||||
|
function TestingMinimalRouterWrapper({
|
||||||
children,
|
children,
|
||||||
location,
|
location,
|
||||||
}: {
|
}: {
|
||||||
@ -23,9 +27,9 @@ describe('OpenInDesktopAppHandler tests', () => {
|
|||||||
test(`does not render the modal if no query param is present`, () => {
|
test(`does not render the modal if no query param is present`, () => {
|
||||||
render(
|
render(
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<TestWrap>
|
<TestingMinimalRouterWrapper>
|
||||||
<p>Dummy app contents</p>
|
<p>Dummy app contents</p>
|
||||||
</TestWrap>
|
</TestingMinimalRouterWrapper>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,9 +43,9 @@ describe('OpenInDesktopAppHandler tests', () => {
|
|||||||
test(`renders the modal if the query param is present`, () => {
|
test(`renders the modal if the query param is present`, () => {
|
||||||
render(
|
render(
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<TestWrap location="/?ask-open-desktop">
|
<TestingMinimalRouterWrapper location="/?ask-open-desktop">
|
||||||
<p>Dummy app contents</p>
|
<p>Dummy app contents</p>
|
||||||
</TestWrap>
|
</TestingMinimalRouterWrapper>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user