import { mount } from '@vue/test-utils'; import LinkCopiedSnackbar from '@/components/modal/snackbars/LinkCopiedSnackbar.vue'; import { VBtn, VSnackbar } from 'vuetify/components'; describe('LinkedCopiedSnackbar', () => { it('should render the snackbar correctly when modelValue is set to true', async () => { const wrapper = mount(LinkCopiedSnackbar); const snack = wrapper.findComponent(VSnackbar); await snack.setValue(true); expect(snack.isVisible()).toBe(true); }); it('should close the snackbar when the close button is clicked', async () => { const wrapper = mount(LinkCopiedSnackbar); await wrapper.setProps({ modelValue: true }); const closeButton = wrapper.findComponent(VBtn); await closeButton.trigger('click'); expect(wrapper.emitted('update:modelValue')).toBeTruthy(); const snackbar = wrapper.findComponent(VSnackbar); expect(snackbar.props('modelValue')).toBe(false); }); });