import { describe, it, expect } from 'vitest' import { mount } from '@vue/test-utils' import VMessage from '../src/components/message/VMessage.vue' describe('VMessage.vue', () => { it('renders the title', () => { const wrapper = mount(VMessage, { props: { title: 'Test Message' } }) expect(wrapper.text()).toContain('Test Message') }) it('shows the correct icon class for type "alert"', () => { const wrapper = mount(VMessage, { props: { title: 'Alert Message', type: 'alert' } }) const icon = wrapper.find('i') expect(icon.classes()).toContain('ri-spam-fill') }) it('shows the close button if closable is true', () => { const wrapper = mount(VMessage, { props: { title: 'Closable Message', closable: true } }) const button = wrapper.find('button[aria-label="Fermer"]') expect(button.exists()).toBe(true) }) it('emits close event when close button is clicked', async () => { const wrapper = mount(VMessage, { props: { title: 'Closable Message', closable: true } }) const button = wrapper.find('button[aria-label="Fermer"]') await button.trigger('click') expect(wrapper.emitted()).toHaveProperty('close') }) })