import { FlipValue, ScanView } from '@3cr/types-ts'; import { mount } from '@vue/test-utils'; import FlipVerticalAction from '@/components/modal/actions/FlipVerticalAction.vue'; import { useViewer3cr } from '@/composables/useViewer3cr'; function makeFlipValue(view: ScanView, value: boolean): FlipValue { return { Version: expect.any(String), View: view, Flipped: value, }; } describe('FlipVerticalAction tests', () => { const viewer3cr = useViewer3cr(); const spy = vi.spyOn(viewer3cr, 'flipVertically').mockResolvedValue(); const props = { view: ScanView.Sagittal }; it('should flip horizontally', async () => { const wrapper = mount(FlipVerticalAction, { props }); const action = wrapper.findComponentByTestId('button'); await action.trigger('click'); expect(spy).toHaveBeenCalledWith({ message: makeFlipValue(props.view, true), }); }); });