import { CurrentScanState, LayoutActions, ScanView } from '@3cr/types-ts'; import { scanState } from '@/models/scanState'; import FullscreenAction from '../FullscreenAction.vue'; import { mount } from '@vue/test-utils'; import { useViewer3cr } from '@/composables/useViewer3cr'; describe('FullscreenAction tests', () => { const viewer3cr = useViewer3cr(); const props = { view: ScanView.Coronal }; const layoutsSpy = vi.spyOn(viewer3cr, 'layouts').mockResolvedValue(); const customLayoutSpy = vi .spyOn(viewer3cr, 'customLayout') .mockResolvedValue(); const viewSpy = vi.spyOn(viewer3cr, 'viewSelection').mockResolvedValue(); it('should fullscreen', async () => { const wrapper = mount(FullscreenAction, { props }); const button = wrapper.findByTestId('button'); await button.trigger('click'); expect(layoutsSpy).toHaveBeenCalledWith(LayoutActions.lo01); expect(viewSpy).toHaveBeenCalledWith(`vs_0${props.view + 1}`); }); it('should exit fullscreen', async () => { scanState.value = { Layout: { PositionData: [{}] } } as CurrentScanState; const wrapper = mount(FullscreenAction, { props }); const button = wrapper.findByTestId('button'); await button.trigger('click'); expect(customLayoutSpy).toHaveBeenCalled(); }); });