import { mount } from '@vue/test-utils'; import { PRICING_URL } from '@/constants'; import DemoUpgradePlanModal from '@/components/demo/DemoUpgradePlanModal.vue'; describe('DemoLicenceEnableCloudStorageModal tests', () => { it('should mount', () => { const props = { modal: true }; const wrapper = mount(DemoUpgradePlanModal, { props }); expect(wrapper).toBeTruthy(); }); it('should close modal', async () => { const props = { modal: true }; const wrapper = mount(DemoUpgradePlanModal, { props }); const close = wrapper.findComponentByTestId('cancel'); await close.trigger('click'); expect(wrapper.emitted('update:modal')).toBeTruthy(); }); it('should open pricing url', async () => { vi.stubGlobal('open', vi.fn()); const spy = vi.spyOn(window, 'open'); const props = { modal: true }; const wrapper = mount(DemoUpgradePlanModal, { props }); const button = wrapper.findComponentByTestId('done'); await button.trigger('click'); expect(spy).toHaveBeenCalledWith(PRICING_URL, '_self'); vi.restoreAllMocks(); }); // TODO: check after coverage // it('should open via input', async () => { // const props = { modal: false }; // const wrapper = mount(DemoUpgradePlanModal, { props }); // const dialog = wrapper.findComponent(VDialog); // await dialog.setValue(true); // }); });