9 lines
403 B
JavaScript
9 lines
403 B
JavaScript
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]);
|