import { test } from 'node:test'; import assert from 'node:assert/strict'; import { pinchZoom } from './usePinchZoom'; test('pinchZoom scales with finger distance', () => { assert.equal(pinchZoom(100, 1, 200), 2); assert.equal(pinchZoom(100, 2, 150), 3); assert.equal(pinchZoom(200, 3, 100), 1.5); }); test('pinchZoom clamps to 1×–5×', () => { assert.equal(pinchZoom(100, 1, 1000), 5); assert.equal(pinchZoom(100, 1, 20), 1); }); test('pinchZoom snaps near 1× and ignores a zero start', () => { assert.equal(pinchZoom(100, 1, 105), 1); assert.equal(pinchZoom(100, 2, 52), 1); assert.equal(pinchZoom(0, 1.7, 120), 1.7); });