import { ScanView } from '@3cr/types-ts'; import { flushPromises, mount } from '@vue/test-utils'; import PanAction from '@/components/modal/actions/PanAction.vue'; import { useViewer3cr } from '@/composables/useViewer3cr'; describe('PanAction tests', () => { const viewer3cr = useViewer3cr(); const spy = vi.spyOn(viewer3cr, 'pan').mockResolvedValue(); it('should disable unity input while active', async () => { const props = { view: ScanView.Volume }; const wrapper = mount(PanAction, { props }); const button = wrapper.findComponent('[data-testid="button"]'); await button.trigger('click'); await flushPromises(); expect(spy).toHaveBeenCalledWith({ message: { Version: '0.0.0', View: ScanView.Volume, Visibility: true }, }); await button.trigger('click'); await flushPromises(); expect(spy).toHaveBeenCalledWith({ message: { Version: '0.0.0', View: ScanView.Volume, Visibility: false }, }); }); });