9 lines
403 B
JavaScript
Raw Normal View History

2026-05-20 21:39:12 +08:00
const assert = require('node:assert');
const { nearestFrames } = require('../scripts/lib/damage_grounding.cjs');
const frames = Array.from({ length: 21 }, (_, i) => ({ timestamp: i * 0.2, index: i + 1 }));
const selected = nearestFrames(frames, 2, 2, 5);
assert.strictEqual(selected.length, 5);
assert.deepStrictEqual(selected.map(item => Number(item.timestamp.toFixed(1))), [1.6, 1.8, 2, 2.2, 2.4]);