feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
27
packages/admin-ui/ui/test/utils/render-with-providers.tsx
Normal file
27
packages/admin-ui/ui/test/utils/render-with-providers.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { render, RenderOptions } from "@testing-library/react"
|
||||
import { PropsWithChildren, ReactElement } from "react"
|
||||
import { BrowserRouter } from "react-router-dom"
|
||||
import { Providers } from "../../src/providers/providers"
|
||||
|
||||
const Wrapper = ({ children }: PropsWithChildren) => {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Providers>{children}</Providers>
|
||||
</BrowserRouter>
|
||||
)
|
||||
}
|
||||
|
||||
const customRender = (
|
||||
ui: ReactElement,
|
||||
options?: Omit<RenderOptions, "wrapper">
|
||||
) => render(ui, { wrapper: Wrapper, ...options })
|
||||
|
||||
export const renderWithProviders = (
|
||||
ui: ReactElement,
|
||||
{ route = "/" } = {},
|
||||
options?: Omit<RenderOptions, "wrapper">
|
||||
) => {
|
||||
window.history.pushState({}, "Test page", route)
|
||||
|
||||
return customRender(ui, options)
|
||||
}
|
||||
Reference in New Issue
Block a user