import NotificationToaster from '@/components/shared/NotificationToaster.vue'; import { mount } from '@vue/test-utils'; const mockNotify = vi.fn(); vi.mock('@kyvg/vue3-notification', () => ({ useNotification: () => ({ notify: mockNotify, }), Notifications: { name: 'Notifications', }, })); describe('NotificationToaster', () => { it('should pass', async () => { expect(true).toBe(true); }); it('displays a success notification with the correct text and icon', () => { const wrapper = mount(NotificationToaster); wrapper.vm.notifySuccess(); expect(mockNotify).toHaveBeenCalledWith({ type: 'success', text: 'This is a Success message!!', duration: 300000, data: { icon: 'check_circle' }, }); }); it('displays a Error notification with the correct text and icon', () => { const wrapper = mount(NotificationToaster); wrapper.vm.notifyError(); expect(mockNotify).toHaveBeenCalledWith({ type: 'error', text: 'This is an Error Message!!', duration: 300000, data: { icon: 'error' }, }); }); it('displays a Warning notification with the correct text and icon', () => { const wrapper = mount(NotificationToaster); wrapper.vm.notifyWarning(); expect(mockNotify).toHaveBeenCalledWith({ type: 'warn', text: 'This is a warning Message!!', duration: 300000, data: { icon: 'warning' }, }); }); it('displays a Info notification with the correct text and icon', () => { const wrapper = mount(NotificationToaster); wrapper.vm.notifyInfo(); expect(mockNotify).toHaveBeenCalledWith({ type: 'info', text: 'This is an informational message!!', duration: 300000, data: { icon: 'check_circle' }, }); }); it('getButtonColor returns the correct color for each type', () => { const wrapper = mount(NotificationToaster); expect(wrapper.vm.getButtonColor('success')).toBe('rgba(29, 127, 22, 1)'); expect(wrapper.vm.getButtonColor('error')).toBe('rgba(202, 52, 74, 1)'); expect(wrapper.vm.getButtonColor('warn')).toBe('rgba(166, 103, 2, 1)'); expect(wrapper.vm.getButtonColor('info')).toBe('rgba(27, 109, 131, 1)'); expect(wrapper.vm.getButtonColor(undefined)).toBe(''); }); });