M8-R18: stabilize Mantine frontend tests
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
import { screen } from '@testing-library/react'
|
||||||
|
import { useMantineEnv } from '@mantine/core'
|
||||||
|
import { describe, expect, it } from 'vitest'
|
||||||
|
import { renderWithProviders } from './test-utils'
|
||||||
|
|
||||||
|
function MantineEnvironmentProbe() {
|
||||||
|
return <output>{useMantineEnv()}</output>
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('renderWithProviders', () => {
|
||||||
|
it('uses Mantine test environment', () => {
|
||||||
|
renderWithProviders(<MantineEnvironmentProbe />)
|
||||||
|
|
||||||
|
expect(screen.getByText('test')).toBeInTheDocument()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -51,7 +51,7 @@ export function renderWithProviders(ui: ReactNode, options: RenderOptions = {})
|
|||||||
|
|
||||||
function Wrapper() {
|
function Wrapper() {
|
||||||
return (
|
return (
|
||||||
<MantineProvider>
|
<MantineProvider env="test">
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<MemoryRouter initialEntries={entries}>
|
<MemoryRouter initialEntries={entries}>
|
||||||
<Routes>
|
<Routes>
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ export default defineConfig({
|
|||||||
test: {
|
test: {
|
||||||
environment: 'jsdom',
|
environment: 'jsdom',
|
||||||
globals: true,
|
globals: true,
|
||||||
|
// Mantine-heavy UI tests allocate substantial jsdom resources. Keep the
|
||||||
|
// worker pool bounded so concurrent CI jobs remain reliable.
|
||||||
|
maxWorkers: 2,
|
||||||
setupFiles: ['./src/test-setup.ts'],
|
setupFiles: ['./src/test-setup.ts'],
|
||||||
env: {
|
env: {
|
||||||
// Lock the test timezone to UTC so that date-formatting assertions
|
// Lock the test timezone to UTC so that date-formatting assertions
|
||||||
|
|||||||
Reference in New Issue
Block a user