chore: fix and migrate unit tests to vitest
This commit is contained in:
27
apps/scandic-web/tests/utils.tsx
Normal file
27
apps/scandic-web/tests/utils.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { render, type RenderOptions } from "@testing-library/react"
|
||||
import React, { type ReactElement } from "react"
|
||||
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import messages from "@/i18n/dictionaries/en.json"
|
||||
import ClientIntlProvider from "@/i18n/Provider"
|
||||
|
||||
function AllTheProviders({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<ClientIntlProvider
|
||||
defaultLocale={Lang.en}
|
||||
locale={Lang.en}
|
||||
messages={messages}
|
||||
>
|
||||
{children}
|
||||
</ClientIntlProvider>
|
||||
)
|
||||
}
|
||||
|
||||
const customRender = (
|
||||
ui: ReactElement,
|
||||
options?: Omit<RenderOptions, "wrapper">
|
||||
) => render(ui, { wrapper: AllTheProviders, ...options })
|
||||
|
||||
export * from "@testing-library/react"
|
||||
export { customRender as render }
|
||||
Reference in New Issue
Block a user