import { describe, it, expect } from 'vitest';
import { getNodeGestureConfig, getViewportGestureConfig } from '../utils/gesture-configs';

describe('gesture-configs', () => {
	describe('getNodeGestureConfig', () => {
		it('returns config for finger input', () => {
			const config = getNodeGestureConfig('finger');
			expect(config.drag.threshold).toBe(10);
			expect(config.drag.tapsThreshold).toBe(10);
		});

		it('returns config for pencil input', () => {
			const config = getNodeGestureConfig('pencil');
			expect(config.drag.threshold).toBe(2);
		});

		it('returns config for mouse input', () => {
			const config = getNodeGestureConfig('mouse');
			expect(config.drag.threshold).toBe(3);
			expect(config.drag.tapsThreshold).toBe(5);
		});

		it('all configs disable passive events', () => {
			for (const source of ['finger', 'pencil', 'mouse'] as const) {
				const config = getNodeGestureConfig(source);
				expect(config.eventOptions.passive).toBe(false);
			}
		});
	});

	describe('getViewportGestureConfig', () => {
		it('extends node config with pinch and wheel', () => {
			const config = getViewportGestureConfig('mouse');
			expect(config.pinch).toBeDefined();
			expect(config.wheel).toBeDefined();
		});

		it('finger viewport has larger threshold', () => {
			const config = getViewportGestureConfig('finger');
			expect(config.drag.threshold).toBe(10);
		});
	});
});
