Skip to content
Source
Sign inSign up

HistorySwipeNavigation.test.ts

15 lines541 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { isMomentumTail } from "./HistorySwipeNavigation";
4​
5describe("isMomentumTail", () => {
6 it.each([
7 ["steady momentum decay", [40, 37, 34, 31.3, 28.8], true],
8 ["fingers still moving", [12, 18, 9, 15, 11], false],
9 ["fingers slowing unevenly", [30, 22, 20, 12, 11], false],
10 ["reversing", [10, 8, 6, 4, -2], false],
11 ["too few samples", [40, 37, 34], false],
12 ])("%s", (_name, deltas, expected) => {
13 expect(isMomentumTail(deltas)).toBe(expected);
14 });
15});