import { describe, it, expect, vi } from 'vitest'
import { render, screen } from '@testing-library/react'
import { ErrorBoundary } from '@/components/ErrorBoundary'
const ThrowError = () => {
throw new Error('test error')
}
describe('ErrorBoundary', () => {
it('renders children when no error', () => {
render(
hello
,
)
expect(screen.getByText('hello')).toBeInTheDocument()
})
it('renders fallback on error', () => {
vi.spyOn(console, 'debug').mockImplementation(() => {})
render(
,
)
expect(screen.getByText('Что-то пошло не так')).toBeInTheDocument()
})
})