import { mount } from '@vue/test-utils' import { describe, expect, it } from 'vitest' import ErrorBoundary from '../ErrorBoundary.vue' // Stub UIcon and UButton since they come from Nuxt UI const stubs = { UIcon: { template: '' }, UButton: { template: '' }, } describe('errorBoundary', () => { it('renders slot content when no error', () => { const wrapper = mount(ErrorBoundary, { slots: { default: '
Hello World
', }, global: { stubs }, }) expect(wrapper.text()).toContain('Hello World') }) it('does not show error UI by default', () => { const wrapper = mount(ErrorBoundary, { slots: { default: '
Content
', }, global: { stubs }, }) expect(wrapper.text()).not.toContain('Something went wrong') expect(wrapper.text()).toContain('Content') }) })