import { describe, it, expect } from 'vitest';
import { swipeDirection } from './swipe';

describe('swipeDirection', () => {
    it('classifies a leftward horizontal swipe as next', () => {
        expect(swipeDirection(-100, 8)).toBe('next');
    });

    it('classifies a rightward horizontal swipe as prev', () => {
        expect(swipeDirection(120, -10)).toBe('prev');
    });

    it('ignores a swipe shorter than the threshold', () => {
        expect(swipeDirection(-20, 2)).toBeNull();
    });

    it('ignores a mostly-vertical drag so panning does not turn the page', () => {
        expect(swipeDirection(-50, 90)).toBeNull();
    });
});
