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